Unix Technical Forum

BUG #2335: Order of data in data-only dumps

This is a discussion on BUG #2335: Order of data in data-only dumps within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2335 Logged by: Jozef Behran Email address: jozef.behran@krs.sk PostgreSQL version: ...


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

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:50 AM
Jozef Behran
 
Posts: n/a
Default BUG #2335: Order of data in data-only dumps


The following bug has been logged online:

Bug reference: 2335
Logged by: Jozef Behran
Email address: jozef.behran@krs.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

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 05:41 AM.


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