Re: How to compare the schemas ? - Mailing list pgsql-admin

From Ian FREISLICH
Subject Re: How to compare the schemas ?
Date
Msg-id E1DnYAd-0004Bl-Rg@hetzner.co.za
Whole thread Raw
In response to Re: How to compare the schemas ?  (Scott Marlowe <smarlowe@g2switchworks.com>)
List pgsql-admin
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

pgsql-admin by date:

Previous
From: "Martin Fandel"
Date:
Subject: Re: change existing table definition
Next
From: Nasir Iqbal Danish
Date:
Subject: Re: wal logs in pg_xlog