pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
How to generate drop cascade with pg_dump 2+ messages / 2 participants [nested] [flat]
* How to generate drop cascade with pg_dump @ 2013-01-08 21:53 Emi Lu <emilu@encs.concordia.ca> 0 siblings, 1 reply; 2+ messages in thread From: Emi Lu @ 2013-01-08 21:53 UTC (permalink / raw) To: pgsql-sql Hello, May I know how to generate drop table cascade when pg_dump a schema please? E.g., pg_dump -h db_server -E UTF8 -n schema_name -U schema_owner --clean -d db_name >! ~/a.dmp In a.dmp, I'd like to get: drop table t1 cascade; drop table t2 cascade; ... ... Only dropping constraints within a schema is not good enough since there are dependencies on other schema. Thanks a lot! Emi -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: How to generate drop cascade with pg_dump @ 2013-01-09 16:52 Adrian Klaver <adrian.klaver@gmail.com> parent: Emi Lu <emilu@encs.concordia.ca> 0 siblings, 0 replies; 2+ messages in thread From: Adrian Klaver @ 2013-01-09 16:52 UTC (permalink / raw) To: emilu@encs.concordia.ca; +Cc: pgsql-sql On 01/08/2013 01:53 PM, Emi Lu wrote: > Hello, > > May I know how to generate drop table cascade when pg_dump a schema please? > > E.g., > pg_dump -h db_server -E UTF8 -n schema_name -U schema_owner --clean > -d db_name >! ~/a.dmp > > In a.dmp, I'd like to get: > > drop table t1 cascade; > drop table t2 cascade; > ... ... > > Only dropping constraints within a schema is not good enough since there > are dependencies on other schema. That is a limitation of dumping by schema. http://www.postgresql.org/docs/9.2/interactive/app-pgdump.html "Note: When -n is specified, pg_dump makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database. If you want to reach across schemas you either need to do a whole database dump or modify a partial dump or create your own script. > > Thanks a lot! > Emi > > -- Adrian Klaver adrian.klaver@gmail.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-01-09 16:52 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2013-01-08 21:53 How to generate drop cascade with pg_dump Emi Lu <emilu@encs.concordia.ca> 2013-01-09 16:52 ` Adrian Klaver <adrian.klaver@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox