From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Phillip F Jansen <pfj(at)ucs(dot)co(dot)za> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Comparing tables in different db's |
Date: | 2001-08-10 10:25:22 |
Message-ID: | 200108101025.f7AAPMYx012487@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Phillip F Jansen wrote:
>I would like to know if there is a way to compare the data of tables in
>different databases. For example I have table in db1 and exactly the
>same table in db2. Is it possible to see if the contents of the two
>tables are exactly the same?
>For example if the table(db1.customer) has a column surname and the
>field has a value of "Testing" and in db2.customer the exact same row
>has a value "Testong" is it possible to actually know that there is a
>difference ? I don't actually have to know what the actual differences
>are , I must just know that there is a difference.
You can't do it inside PostgreSQL. However, this shell script will do it:
psql -d db1 -tc "SELECT surname FROM customer WHERE id = 'xxx'" >db1.out
psql -d db2 -tc "SELECT surname FROM customer WHERE id = 'xxx'" >db2.out
if ! diff db1.out db2.out >/dev/null
then
echo Databases differ
fi
rm db[12].out
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"If ye abide in me, and my words abide in you, ye shall
ask what ye will, and it shall be done unto you."
John 15:7
From | Date | Subject | |
---|---|---|---|
Next Message | Vince Vielhaber | 2001-08-10 10:38:08 | Re: OpenFTS (Open Source Full Text Search engine) pre-announce |
Previous Message | Rene Pijlman | 2001-08-10 10:07:59 | Re: Re: What needs to be done? |