Predictable order of SQL commands in pg_dump

From: "Dmitry Koterov" <dmitry(at)koterov(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Predictable order of SQL commands in pg_dump
Date: 2008-09-21 01:05:02
Message-ID: d7df81620809201805m470993c2o816bc62124c77bf6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

Utility pg_dump dumps the identical database schemas not always
identically: sometimes it changes an order of SQL statements.
E.g.:

1. Dump of database A:

ALTER TABLE xxx ADD CONSTRAINT ...;
ALTER TABLE yyy ADD CONSTRAINT ...;

2. Dump of database B which has identical structure as A ("pg_dump A |
psql -d B" was executed)

ALTER TABLE yyy ADD CONSTRAINT ...;
ALTER TABLE xxx ADD CONSTRAINT ...;

This behaviour is not good, because I cannot execute diff to visually
view what was changed between databases A and B. (I use this diff only
for visual detection, please do not refer I want to use this diff for
schema migration - I don't want it!).

Is it possible to make pg_dump more predictable in SQL ordering?
What order does it use by default?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-21 01:28:09 Re: Predictable order of SQL commands in pg_dump
Previous Message Tom Lane 2008-09-21 00:56:57 Re: [patch] fix dblink security hole