pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Ian FREISLICH <if@hetzner.co.za>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: Milorad Poluga <milorad.poluga@cores.co.yu>
Cc: pgsql-admin@postgresql.org
Subject: Re: How to compare the schemas ?
Date: Tue, 28 Jun 2005 10:41:33 -0500
Message-ID: <1119973293.8208.107.camel@state.g2switchworks.com> (raw)
In-Reply-To: <E1DnGCE-0000ps-Rv@hetzner.co.za>
References: <E1DnGCE-0000ps-Rv@hetzner.co.za>

On Tue, 2005-06-28 at 08:32, Ian FREISLICH wrote:
> Peter Eisentraut wrote:
> > Milorad Poluga wrote:
> > > One (certainly not the best options) is to do something like this:
> > >
> > > pg_dump ... DB1 =A0> PG_SCHEMA1
> > > pg_dump ... DB2 =A0> PG_SCHEMA2
> > > diff =A0PG_SCHEMA1 =A0PG_SCHEMA2 =A0> differences.txt
> > 
> > What is wrong with that?
> 
> All the extra TOC ID and comment stuff that pg_dump introduces.
> Also, I think that the dump is sorted by creation order or some
> other scheme, so even though the databases might be identical, the
> diff output would be significant.
> 
> This is something that I have battled in the past.  The only solution
> was to always update the database from a set of scripts, one for
> each function and one for the tables.  These scripts kept in CVS
> auto update the comment on each object:
> 
> COMMENT ON FUNCTION namedConfGen(TEXT,TEXT) IS '$Id: sproc.api.namedConfGen,v 1.
> 8 2004/05/07 08:02:55 ianf Exp $';
> 
> Now I can cvs diff using the version numbers.  Not ideal, but at
> least I know exactly where I am.

I just pass a schema backup through grep or sed with this option:

grep -Pv "^--" 

and get a pretty good idea of the differences.

Since our databases are created by scripts as well, they generally share
creation order and such, so any small difference from missing a script
on one or another environment shows up with this.



view thread (6+ messages)  latest in thread

Message-ID: <1119973293.8208.107.camel@state.g2switchworks.com>
Permalink:  ../1119973293.8208.107.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1119973293.8208.107.camel@state.g2switchworks.com

 · 

reply

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: smarlowe@g2switchworks.com, if@hetzner.co.za, peter_e@gmx.net, milorad.poluga@cores.co.yu
  Subject: Re: How to compare the schemas ?
  In-Reply-To: <1119973293.8208.107.camel@state.g2switchworks.com>
  References: <E1DnGCE-0000ps-Rv@hetzner.co.za> <1119973293.8208.107.camel@state.g2switchworks.com>

* 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