pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: M.P.Dankoor <m.p.dankoor@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Comparing two tables of different database
Date: Sat, 02 May 2009 12:16:41 +0200
Message-ID: <49FC1D89.2070007@gmail.com> (raw)
In-Reply-To: <e13d0d10904282339r1f853e1cpe3514e53ae47e5ef@mail.gmail.com>
References: <e13d0d10904282339r1f853e1cpe3514e53ae47e5ef@mail.gmail.com>

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




view thread (18+ messages)  latest in thread

Message-ID: <49FC1D89.2070007@gmail.com>
Permalink:  ../49FC1D89.2070007@gmail.com/
Also on:    postgresql.org/message-id/49FC1D89.2070007@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: m.p.dankoor@gmail.com
  Subject: Re: Comparing two tables of different database
  In-Reply-To: <49FC1D89.2070007@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox