6

I am trying to dump a schema from Postgres 9.4, running on Cents 6.5, but I get an error:

pg_dump: No matching schemas were found

Here is the command I am running:

pg_dump -U postgres -n "OLD-TODELETE-bushes" --verbose site > output_nf

I am a little confused by this as when I run select schema_name from information_schema.schemata, I can see the schema name.

If I run pg_dump for all schemas the OLD-TODELETE-bushes is dumped to file, as expected.

There are no error's in the Postgres logs.

Anyone have any ideas?

2
  • 1
    Did you try it without the quotes around the schema name? I suppose that you did the pg_dump for all schema's with the same user and for the same database (site)?
    – Marco
    Aug 27, 2015 at 11:59
  • Yeah tried it with and without quotes and with same user, same db... Works fine for every other schema in the database. Aug 27, 2015 at 13:31

1 Answer 1

7

Fixed this by changing the quotes from "schema_name" to '"schema_name"'

See: pg_dump doesn't dump datascheme with uppercase letters in

...where Tom Lane replied:

The problem is that there are two levels of quoting needed: one for the shell and one for SQL. As you wrote it, the double quotes are stripped off by the shell and so pg_dump gets Schema, which is case-folded per normal SQL rules. So you need to write:

pg_dump -n '"Schema"' -U postgres database

Now, the shell eats the single quotes and passes "Schema" to pg_dump.

1
  • 1
    Important to note (like Tom Lane did, too): this is not a bug, just your missing quotes. My standing advice is no use legal lower-case identifiers in Postgres and never have to deal with such problems. Sep 4, 2015 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.