0

I'm using pg_dump to export only the DDL from a database. It's working fine, however the create schema command is not included in the output file.

Here is what I'm using:

pg_dump -s -c -t myschema.mytable connectionURI

Everything works as expected, but I was expecting a create schema myschema command. Is there an option I'm missing?

2
  • 3
    No. If you export the entire schema (with -n [schema]), it will be included, but if specific tables are selected with -t, only the CREATE TABLE (& other statements that operate on the table - constraints, permissions etc) will be generated. – AdamKG Apr 28 at 21:48
  • @AdamKG: You might post that as answer? (I tried with a combination of -n and -t, but -t suppresses CREATE SCHEMA like you stated.) – Erwin Brandstetter Apr 29 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.