dbTalk Databases Forums  

[BUGS] BUG #2335: Order of data in data-only dumps

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2335: Order of data in data-only dumps in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jozef Behran
 
Posts: n/a

Default [BUGS] BUG #2335: Order of data in data-only dumps - 03-18-2006 , 05:55 PM







The following bug has been logged online:

Bug reference: 2335
Logged by: Jozef Behran
Email address: jozef.behran (AT) krs (DOT) sk
PostgreSQL version: 8.1.0
Operating system: Linux (Mandriva Linux 10.0)
Description: Order of data in data-only dumps
Details:

When doing a data-only dump, the tables are dumped in alphabetical order.
This is unfortunate as I might want to fetch the file into a fully created
schema (including indices/constraints) for example to prevent bad data from
being fetched without an error ot to accomodate old data in a new schema and
the alphabetical order of the tables may be wrong.

Older versions (7.x particularly) ensure the order of the tables in the dump
is such that it can be fetched into fully created schema without problems.

It is OK to have the tables ordered aplabetically in full dumps as it is
unlikely to fetch such dump into something other than an empty database.

To see some problematic data try:

BEGIN;
CREATE TABLE b (
id int4,
PRIMARY KEY(id)
);
CREATE TABLE a (
id int4,
other int4 references b
on update cascade on delete cascade
);
INSERT INTO b VALUES (1);
INSERT INTO a VALUES (1,1);
COMMIT;

Then try

pg_dump -a <database_name>

The pg_dump will dump a, then b but it should do it in reverse order.

I think the few more CPU cycles needed to sort the tables like in 7.x series
is not worth the reduced usability of the dumps when incorrect table order
is used. Especially when the order of data does not break anything even in
the full dump.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.