Re: [SOLVED] Postgres schema comparison.

From: Stef <svb(at)ucs(dot)co(dot)za>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: pgsql-ADMIN(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SOLVED] Postgres schema comparison.
Date: 2005-03-07 16:08:37
Message-ID: 20050307180837.44cd681f@svb.ucs.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

John DeSoi mentioned :
=> I'm not sure you can use \d directly, but if you startup psql with the
=> -E option it will show you all the SQL it is using to run the \d
=> command. It should be fairly easy to get the strings you need from the
=> results of running a similar query. The psql source is a good place to
=> look also.

Sometimes you just need to see things from a different perspective.
Thanks!

Here's my final solution that runs in less than a minute for +- 543 tables :
for x in $(psql -tc "select relname from pg_class where relkind = 'r' and relname not like 'pg_%'")
do
echo "$(psql -tc "select encode(digest('$(psql -c '\d '${x}'' mer9188_test | tr -d \"\'\")', 'md5'), 'hex')" mer9188_test | grep -v "^$"|tr -d " "):${x}"
done > compare_list.lst

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Jim Buttafuoco 2005-03-07 16:14:09 Re: [ADMIN] Postgres schema comparison.
Previous Message Michael Fuhr 2005-03-07 16:00:23 Re: Backup procedure

Browse pgsql-sql by date

  From Date Subject
Next Message Jim Buttafuoco 2005-03-07 16:14:09 Re: [ADMIN] Postgres schema comparison.
Previous Message Goulet, Dick 2005-03-07 15:33:08 Re: Postgres schema comparison.