0

context: a java app that use flyway to execute db scripts if the schema is empty, connecting via jdbc.

Due to some mistake on my part, I forgot to add the app user as the public schema owner. That led flyway to create a schema with the funny name: "$user", public . Yes, like this. I changed the public owner, relaunch the application ,and that went well, my tables were created.

I just can't figure out how to clean up the schema, and escape the quote and comma in the name. Any idea ? I'm fairly new to postgres.

  \dn
  schemas list
        name       |  owner
   "$user", public | myuser
   public          | myuser
 (2 lines)
jlb
  • 358
  • 3
  • 15
  • That seems pretty stupid of Flyway - apparently it assumed that the `search_path` is a single schema, not a list of schemas. –  May 10 '21 at 09:45

1 Answers1

2

To drop that schema, you need to duplicate the quotes - just like you do with single quotes in a String constant:

drop schema """$user"", public" cascade;
  • yes, thank you ! I had to add cascade but that worked. I'll accept as soon as SO allows me. – jlb May 10 '21 at 09:46