Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id CBF5C63350D for ; Sat, 2 May 2009 07:25:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 40547-08 for ; Sat, 2 May 2009 07:24:56 -0300 (ADT) X-Greylist: delayed 00:07:45.741006 by SQLgrey-1.7.6 Received: from smtp-vbr8.xs4all.nl (smtp-vbr8.xs4all.nl [194.109.24.28]) by mail.postgresql.org (Postfix) with ESMTP id 7146F63282F for ; Sat, 2 May 2009 07:25:02 -0300 (ADT) Received: from [192.168.1.63] (213-84-236-203.adsl.xs4all.nl [213.84.236.203]) (authenticated bits=0) by smtp-vbr8.xs4all.nl (8.13.8/8.13.8) with ESMTP id n42AHD0B073236 for ; Sat, 2 May 2009 12:17:14 +0200 (CEST) (envelope-from m.p.dankoor@gmail.com) Message-ID: <49FC1D89.2070007@gmail.com> Date: Sat, 02 May 2009 12:16:41 +0200 From: "M.P.Dankoor" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Comparing two tables of different database References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/3 X-Sequence-Number: 32495 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