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

Re: pg_dump not in object dependency order for sequences used for pri mary keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Garris, Nicole" <Nicole(dot)Garris(at)dof(dot)ca(dot)gov>
Cc: "'pgsql-admin(at)postgresql(dot)org'" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_dump not in object dependency order for sequences used for pri mary keys
Date: 2005-04-21 16:06:11
Message-ID: 16052.1114099571@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
"Garris, Nicole" <Nicole(dot)Garris(at)dof(dot)ca(dot)gov> writes:
> 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.

How so?  The nextval only references the sequence as a string; it's not
going to trigger any failure at create time.  Please show a specific
test case instead of assuming you know what the problem is.

			regards, tom lane

In response to

pgsql-admin by date

Next:From: Thomas F.O'ConnellDate: 2005-04-21 17:36:16
Subject: Re: PG SQL scripts
Previous:From: Nuno SoutoDate: 2005-04-21 15:53:39
Subject: FW: PostgreSQL (real and effective user ids must match) error

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