Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> writes: > On 2/12/2009 3:41 PM, silly8888 wrote: >> pg_dump dumps data first and then the constraints (including FK) so >> there shouldn't be any problems when you import the dump. > ... assuming you're using a sufficiently recent version of pg_dump. > Wasn't that added fairly recently? Depends on context, which the OP provided none of. pg_dump has handled FK dependencies -- even circular ones -- correctly for a long time, given that you're doing a full schema+data dump. If you ask it for a data-only dump, there is no way to handle circular dependencies, so until recently it just threw up its hands and dumped the tables in an arbitrary order. Recent versions (I think probably only 8.4.x) will order a data-only dump correctly for FK considerations so long as there are no circular dependencies. If you must use a data-only dump pre-8.4, I'd suggest using pg_restore's -L switch to manually control the restore order. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general