Thread: BUG #1801: pg_dump dumps tables in alphabetical order, not as created

BUG #1801: pg_dump dumps tables in alphabetical order, not as created

From
"Peter Valach"
Date:
The following bug has been logged online:

Bug reference:      1801
Logged by:          Peter Valach
Email address:      valach@pv2c.sk
PostgreSQL version: 8.0.3
Operating system:   Linux (Gentoo)
Description:        pg_dump dumps tables in alphabetical order, not as
created
Details:

When using pg_dump, it stores tables inside dump file in alphabetical order,
not in the order they were created. This is not a problem for full dump
(because foreign keys are created at the end), but it is a big problem for
--data-only.

Example: I have two tables "aaa" and "bbb", and some column from "aaa"
references "bbb". Before (7.x.x), pg_dump --data-only will dump "bbb" table
first, "aaa" second (they were created in this order) and restore will go
OK. Now (8.0.x, 8.0.1 and 8.0.3 tested) it dumps "aaa" first and I get "...
violates foreign key" messages and no "aaa" table data is restored.

I hope I'm not missing something, but I didn't find anything about this in
pg_dump docs.