Re: problem with pg_dump and subsequent restoration. - Mailing list pgsql-novice

From Tom Lane
Subject Re: problem with pg_dump and subsequent restoration.
Date
Msg-id 16202.1126815457@sss.pgh.pa.us
Whole thread Raw
In response to problem with pg_dump and subsequent restoration.  ("Morgan Kita" <mkita@verseon.com>)
List pgsql-novice
"Morgan Kita" <mkita@verseon.com> writes:
> As an example when I ran the dump I used: pg_dump -a my_db -f my_db_bakup.sql

> When restoring the database I first restored the schema from a separate backup of just the schema that I ran as
pg_dump-s my_db -f my_db_schema.sql. 

> Then I restored the data like: psql my_db < my_db_bakup.sql.

> However, for a few of my major tables I failed on foreign key constraints to tables that had not yet been loaded.
ErgoI had a order dependancy issue. 

It's simpler, more reliable, and generally faster to just use a normal
(schema + data) dump.  pg_dump will manage the foreign keys properly
when you do that, but it cannot promise anything about data-only dumps.

If you're really intent on using data-only dumps, you can use
--disable-triggers while restoring, but bear in mind that that
defeats the foreign key checks entirely ... you might end up with
inconsistent data and not know it.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Walker, Jed S"
Date:
Subject: Is a table temporary
Next
From: Tom Lane
Date:
Subject: Re: Is a table temporary