From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Lubratt <mark.lubratt@indeq.com>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [ADMIN] Schema comparisons
Date: Sat, 28 Feb 2004 10:39:40 -0500
Message-ID: <27965.1077982780@sss.pgh.pa.us> (raw)
In-Reply-To: <4F7D4521-69BC-11D8-ACD3-000A9579AF50@indeq.com>
References: <C4BBB0BE-699E-11D8-ACD3-000A9579AF50@indeq.com>
<25377.1077942505@sss.pgh.pa.us>
<4F7D4521-69BC-11D8-ACD3-000A9579AF50@indeq.com>
Mark Lubratt <mark.lubratt@indeq.com> writes:
> On Feb 27, 2004, at 10:28 PM, Tom Lane wrote:
>> Mark Lubratt <mark.lubratt@indeq.com> writes:
>>> I've been trying to be careful, but I've gotten out of synch with
>>> whether or not I've applied the changes I've made to the development
>>> system to the production system. Is there a utility that will compare
>>> the tables, functions, trigger, views, etc. between two systems and
>>> flag the schema elements that aren't in synch between the two?
>>
>> Have you tried diffing pg_dump output? It's not the greatest tool but
>> it's helpful.
> Yes, I did. It was quite cumbersome. Especially since the OIDs and
> TOC entry numbers didn't matchup; and, since those didn't always match,
> the order of objects wasn't quite the same either. So, diff was
> throwing a lot of false positives at me.
Yeah. CVS-tip pg_dump doesn't show OIDs by default, to make it easier
to use for purposes like this. The ordering issue is the bigger problem
though. I presume that the object creation history is different in the
two databases and so pg_dump's habit of sorting by OID isn't helpful.
It occurs to me that this could be solved now that we have
dependency-driven ordering in pg_dump. The ordering algorithm is
presently
* Order by object type, and by OID within types;
* Move objects as needed to honor dependencies.
Ordering by OID should no longer be needed for correctness, because
the second phase will take care of any dependency problems. We
could instead make the initial sort be by object name (within types).
This should ensure that the schema output is identical for logically
equivalent databases, even if their history is different.
(When dumping from a pre-7.3 database, we'd have to stick to the OID
algorithm for lack of dependency info, but of course that case is
getting less interesting as time wears on.)
Comments? Anyone see a reason not to do this?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, mark.lubratt@indeq.com, pgsql-hackers@postgreSQL.org
Subject: Re: [ADMIN] Schema comparisons
In-Reply-To: <27965.1077982780@sss.pgh.pa.us>
References: <C4BBB0BE-699E-11D8-ACD3-000A9579AF50@indeq.com> <25377.1077942505@sss.pgh.pa.us> <4F7D4521-69BC-11D8-ACD3-000A9579AF50@indeq.com> <27965.1077982780@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox