Unix Technical Forum

pg_dump object dump-order

This is a discussion on pg_dump object dump-order within the pgsql Admins forums, part of the PostgreSQL category; --> Greetings I'm working with PostgreSQL for quite some time now but only yesterday ran into a specific problem, as ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:11 AM
KL
 
Posts: n/a
Default pg_dump object dump-order

Greetings


I'm working with PostgreSQL for quite some time now
but only yesterday ran into a specific problem, as - so far -
I have always used customized backup/restore-scripts.

PROBLEM:
pg_dump seems to dump objects strictly alphabetically,
I presume. Hence a table "events" is always dumped
_before_ any sequence "events_id_seq" that is already
being referenced in the "create table"-statement for
table "events".

Example

CREATE TABLE event (
event_id integer DEFAULT nextval('event_id_seq'::text) NOT NULL,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:11 AM
Tom Lane
 
Posts: n/a
Default Re: pg_dump object dump-order

KL <zappa_lot@gmx.net> writes:
> pg_dump seems to dump objects strictly alphabetically,


No, it doesn't ... at least not if you are running 8.0 or later.
It looks at dependencies to see what has to be dumped first.
(It does prefer alpha order when there's no dependency constraint.)

There are various situations where there might not be a dependency
entry, but without knowing more about the history of the table and
exactly which version you're running, it's hard to speculate about
why or what's the best fix.

I will point out, however, that the given script does not in fact
fail to load in any Postgres version known to me. Maybe you should
post your real problem instead of an oversimplified example.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:21 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com