Re: [ADMIN] Postgres schema comparison.

From: "Jim Buttafuoco" <jim(at)contactbda(dot)com>
To: Stef <svb(at)ucs(dot)co(dot)za>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [ADMIN] Postgres schema comparison.
Date: 2005-03-07 16:14:09
Message-ID: 20050307160942.M57950@contactbda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql


Stef,

I use dblink to attach to both databases and query pg_namespace, pg_class, pg_attribute ... to get the diffs. See
attached as an example. look for the dblink_connect lines to specify your database. You will need to install
contrib/dblink. I used this with 7.4.X series and have NOT tested yet with 8.0.X.

You can adjust the output to fit your needs.

Jim

---------- Original Message -----------
From: Stef <svb(at)ucs(dot)co(dot)za>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ADMIN(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Sent: Mon, 7 Mar 2005 17:31:55 +0200
Subject: Re: [ADMIN] [SQL] Postgres schema comparison.

> Tom Lane mentioned :
> => > The problem I have with this, is that I have to run the command per table,
> =>
> => Why?
> =>
> => If the problem is varying order of table declarations, try 8.0's
> => pg_dump.
>
> Yes, this will solve the global schema check, but I will still need to split
> it into "per table" dumps , to do "per table" comparisons.
>
> Kind Regards
> Stefan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
------- End of Original Message -------

Attachment Content-Type Size
db_compare.sql application/octet-stream 9.8 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Michael Adler 2005-03-07 16:47:17 Re: Backup procedure
Previous Message Stef 2005-03-07 16:08:37 Re: [SOLVED] Postgres schema comparison.

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2005-03-07 16:15:55 Re: Links between rows in a table
Previous Message Stef 2005-03-07 16:08:37 Re: [SOLVED] Postgres schema comparison.