pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump not in object dependency order for sequences used for pri mary keys
3+ messages / 2 participants
[nested] [flat]
* pg_dump not in object dependency order for sequences used for pri mary keys
@ 2005-04-21 15:39 Garris, Nicole <Nicole.Garris@dof.ca.gov>
2005-04-21 16:06 ` Re: pg_dump not in object dependency order for sequences used for pri mary keys Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Garris, Nicole @ 2005-04-21 15:39 UTC (permalink / raw)
To: pgsql-admin
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!!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pg_dump not in object dependency order for sequences used for pri mary keys
2005-04-21 15:39 pg_dump not in object dependency order for sequences used for pri mary keys Garris, Nicole <Nicole.Garris@dof.ca.gov>
@ 2005-04-21 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2005-04-21 16:06 UTC (permalink / raw)
To: Garris, Nicole <Nicole.Garris@dof.ca.gov>; +Cc: pgsql-admin
"Garris, Nicole" <Nicole.Garris@dof.ca.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
^ permalink raw reply [nested|flat] 3+ messages in thread
* FW: pg_dump not in object dependency order for sequences used for primary keys
@ 2005-04-26 17:55 Garris, Nicole <Nicole.Garris@dof.ca.gov>
0 siblings, 0 replies; 3+ messages in thread
From: Garris, Nicole @ 2005-04-26 17:55 UTC (permalink / raw)
To: pgsql-admin
Quite right, "create sequence" occuring after the "create table" is not the
cause of the problem. Thanks, Tom. (Now I'm suspecting a character
translation problem, most likely with the line feed character.)
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Thursday, April 21, 2005 9:06 AM
To: Garris, Nicole
Cc: 'pgsql-admin@postgresql.org'
Subject: pg_dump not in object dependency order for sequences used for pri
mary keys
"Garris, Nicole" <Nicole.Garris@dof.ca.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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-04-26 17:55 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-21 15:39 pg_dump not in object dependency order for sequences used for pri mary keys Garris, Nicole <Nicole.Garris@dof.ca.gov>
2005-04-21 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-04-26 17:55 FW: pg_dump not in object dependency order for sequences used for primary keys Garris, Nicole <Nicole.Garris@dof.ca.gov>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox