From: | Johannes(dot)Meidert(at)rohde-schwarz(dot)com |
---|---|
To: | eggyknap(at)gmail(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5698: pg_dump (8.3.11) does not consider constrains |
Date: | 2010-10-11 07:35:05 |
Message-ID: | OFD482D191.78A98077-ONC12577B9.00277B5C-C12577B9.0029AA53@rohde-schwarz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On Fri, Oct 08, 2010 at 11:46:31AM +0000, Johannes Meidert wrote:
> > pg_dump dumps tables in the worng order for constraints (table a
refrences
> > key of table b, but table a is dumped first). As a consequence an
import
> > fails, because the required foreign key (in table b) is missing when
table a
> > is imported.
> > Work around: import twice.
> > Is this fixed in version 9.0?
>
> Could you give details of exactly what pg_dump commands you used? By
default
> pg_dump dumps tables and data without any constraints first, and then
adds
> constraints in a valid order. If, however, you do something like dump
the
> schema first, and then dump data into that schema, there's little
pg_dump can
> do to avoid problems such as you describe.
>
Thank you for the explanation.
I dumped with --data-only because my setup creates the tables in advance.
The correct procedure seems to be
if a database exists
dump db
import db
else
create tables
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2010-10-11 07:47:58 | Re: BUG #5699: Postgres runs only under default user. |
Previous Message | Tom Lane | 2010-10-11 04:13:41 | Re: wrong timezone precision using plpythonu trigger |