X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C474653DCF for ; Thu, 21 Apr 2005 12:40:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11698-06 for ; Thu, 21 Apr 2005 15:40:05 +0000 (GMT) Received: from ntrk2.DOF.FINANCE (exchange.dof.ca.gov [134.186.75.161]) by svr1.postgresql.org (Postfix) with ESMTP id DEE7753682 for ; Thu, 21 Apr 2005 12:40:03 -0300 (ADT) Received: by ntrk2.dof.finance with Internet Mail Service (5.5.2657.72) id ; Thu, 21 Apr 2005 08:32:58 -0700 Message-ID: From: "Garris, Nicole" To: "'pgsql-admin@postgresql.org'" Subject: pg_dump not in object dependency order for sequences used for pri mary keys Date: Thu, 21 Apr 2005 08:39:47 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C54688.592E7767" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200504/300 X-Sequence-Number: 17313 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C54688.592E7767 Content-Type: text/plain I am running PostgreSQL 8.0.1 on Max OS X. Rather than using the serial data type for a table's primary key, we use integer and default it to the nexval of a sequence with the name of _seq (this syntax seems to work best with Apple's WebObjects Enterprise Object Modeler). Therefore, the table depends on the sequence, and in a reload of the database, the sequence must be created first. However, pg_dump lists the "create sequence" after the "create table". Of course I cannot use the pg_dump file as-is to reload the database, it fails on the "create table" statement when referencing the (as-yet) non-existent sequence. It would be nice if pg_dump understood the dependency and listed the "create sequence" before the "create table". (If there is some way to get it to do this, please let me know.) In the meantime, I see from the manual that pg_restore can be made to produce an archive.list which is a table of contents for the dump file. I can then reorder the archive.list and feed it to pg_restore to force a restore in the correct order. If this has already been discussed, please point me to the list, year and month and I'll go to the list archives and learn there. Thanks!! ------_=_NextPart_001_01C54688.592E7767 Content-Type: text/html Content-Transfer-Encoding: quoted-printable

I am running PostgreSQL 8.0.1 on Max OS X. Rather than using the serial data = type for a table’s primary key, we use integer and default it to the = nexval of a sequence with the name of <tablename>_seq (this syntax seems to = work best with Apple’s WebObjects Enterprise Object Modeler). = Therefore, the table depends on the sequence, and in a reload of the database, the = sequence must be created first. However, pg_dump lists the “create = sequence” after the “create table”. Of course I cannot use the = pg_dump file as-is to reload the database, it fails on the “create = table” statement when referencing the (as-yet) non-existent = sequence.

 

It would be nice if pg_dump understood the dependency and listed the = “create sequence” before the “create table”. (If there is = some way to get it to do this, please let me know.)

 

In the meantime, I see from the manual that pg_restore can be made to = produce an archive.list which is a table of contents for the dump file. I can then = reorder the archive.list and feed it to pg_restore to force a restore in the = correct order.

 

If this has already been discussed, please point me to the list, year and = month and I’ll go to the list archives and learn there. = Thanks!!

------_=_NextPart_001_01C54688.592E7767--