Re: Comparing two tables of different database - Mailing list pgsql-sql

From M.P.Dankoor
Subject Re: Comparing two tables of different database
Date
Msg-id 49FC1D89.2070007@gmail.com
Whole thread Raw
In response to Comparing two tables of different database  (Nicholas I <nicholas.domnic.i@gmail.com>)
List pgsql-sql
In case dblink was not installed, you could try the following:

1. dump only the data from the table from database 1
pg_dump -U username -a -d -t tablename dbname > tablename.sql

2. create a (temp) table in database 2
SELECT * INTO tablename_bak from tablename WHERE 1 = 2

3. restore the dumped data in the bak table in database 2
pg_restore -U username -a -t tablename_bak dbname tablename.sql

4.select * from tablename except select * from tablename_bak

or you could dump the data from both tables and use some kind of diff tool


Nicholas I wrote:
> Hi,
>
>   can anybody me suggest me, how to compare two tables of different 
> database.
>
> -Nicholas I



pgsql-sql by date:

Previous
From: Wei Weng
Date:
Subject: Re: Comparing two tables of different database
Next
From: Lucas Brito
Date:
Subject: Re: Comparing two tables of different database