pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian FREISLICH <if@hetzner.co.za>
To: Scott Marlowe <smarlowe@g2switchworks.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: How to compare the schemas ?
Date: Wed, 29 Jun 2005 10:43:47 +0200
Message-ID: <E1DnYAd-0004Bl-Rg@hetzner.co.za> (raw)
In-Reply-To: <1119973293.8208.107.camel@state.g2switchworks.com>

Scott Marlowe wrote:
> > 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.

Yes, I've done that too, but grepping for the comments which have
the CVS ID.  Both can be sorted so you get a reasonable diff.
However, if the creation order is different, then a straight diff
of the full schema dumps is useless.

I see that there is a way to dump a single table 'pg_dump -t table'
so you could dump a table at a time and diff the individual tables.

I see that there is no similar option for functions, triggers, types
and opperators (have I left anything out?).  Then these dumps could
be entirely scripted and usefull diff output could be obtained.

I guess I could write a perl function to dump the relevant bits of
the information schema in a way that will diff nicely.  I'll look
into that next time I need to do this.

Ian

--
Ian Freislich



view thread (6+ messages)

Message-ID: <E1DnYAd-0004Bl-Rg@hetzner.co.za>
Permalink:  ../E1DnYAd-0004Bl-Rg@hetzner.co.za/
Also on:    postgresql.org/message-id/E1DnYAd-0004Bl-Rg@hetzner.co.za

 · 

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: if@hetzner.co.za, smarlowe@g2switchworks.com
  Subject: Re: How to compare the schemas ?
  In-Reply-To: <E1DnYAd-0004Bl-Rg@hetzner.co.za>
  References: <1119973293.8208.107.camel@state.g2switchworks.com> <E1DnYAd-0004Bl-Rg@hetzner.co.za>

* 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