Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group