Re: BUG #2308: pg_dump -a does not respect referential dependencies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matthew George" <georgema(at)corp(dot)earthlink(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2308: pg_dump -a does not respect referential dependencies
Date: 2006-03-08 21:01:30
Message-ID: 17723.1141851690@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Matthew George" <georgema(at)corp(dot)earthlink(dot)net> writes:
> Since the logic obviously exists within pg_dump already to arrange the data
> in the correct order of reference dependencies, can this be added to the
> code path for `pg_dump -a` as well?

No. In a data-only restore there may not be *any* ordering that works
--- consider circular dependencies.

The best practice is to do standard schema+data dumps, wherein the
ordering problem can be handled properly by not creating the FK
constraints until after the data is loaded. If you really want to
do a data-only restore, I'd suggest dropping the FK constraints
and re-adding them afterwards (which will be a lot faster than
row-by-row retail checks would be, anyway).

Another possibility is the --disable-triggers option, but I can't
really recommend that, because if there are any referential problems
in the data you load, that way will fail to catch it.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-03-08 21:10:49 Re: BUG #2307: Buckup and sequences in DEFAULT part
Previous Message John R Pierce 2006-03-08 20:35:25 Re: BUG #2305: "No bufferspace available" error on large insert