Re: How to compare the schemas ?

From: Ian FREISLICH <if(at)hetzner(dot)co(dot)za>
To: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to compare the schemas ?
Date: 2005-06-29 08:43:47
Message-ID: E1DnYAd-0004Bl-Rg@hetzner.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-admin by date

  From Date Subject
Next Message sandhya 2005-06-29 12:36:11 reg:libpqxx on windows
Previous Message Martin Fandel 2005-06-28 20:04:39 Re: change existing table definition