Re: [SQL] Comparing two tables of different database

2009-05-02 Thread Isaac Dover
Thank you, Lucas. I'm from the MS world, still learning these PG things. Though, it appears that the difference is somewhat minor. In my actual implementation, [other database] would be a linked server, which sounds like it would be similar to the PG dblink. Regardless, I've found information schem

Re: [SQL] Comparing two tables of different database

2009-05-02 Thread Lucas Brito
2009/5/2 Isaac Dover > i've not tried this in postgres, but using information_schema makes > comparing structures of databases trivial. i've been using this query for a > while with MSSQL. Maybe this helps to answer the question. > > - isaac > > select ST.Table_Name, ST.Column_Name, DV.Table_Name

Fwd: [SQL] Comparing two tables of different database

2009-05-02 Thread Isaac Dover
i've not tried this in postgres, but using information_schema makes comparing structures of databases trivial. i've been using this query for a while with MSSQL. Maybe this helps to answer the question. - isaac select ST.Table_Name, ST.Column_Name, DV.Table_Name, DV.Column_Name, * from [database

Re: [SQL] Comparing two tables of different database

2009-05-02 Thread Lucas Brito
Nicholas, To use the dblink: 1. In your postgres server you should find a file *dblink.sql*. In my beta installation is in *share/postgresql/contrib*. It is the installation for the dblink contrib module that usually is already compiled in. It will create a lot of dblink functions.

Re: [SQL] Comparing two tables of different database

2009-05-02 Thread M.P.Dankoor
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 d

Re: [SQL] Comparing two tables of different database

2009-05-01 Thread Wei Weng
On 05/01/2009 11:55 AM, John Zhang wrote: Hi Nicholas, The query is across database query. dblink is needed for that task. Hope it helps, John On Thu, Apr 30, 2009 at 3:07 PM, Edward W. Rouse mailto:ero...@comsquared.com>> wrote: Can’t you use this? select name from database2.s

Re: [SQL] Comparing two tables of different database

2009-05-01 Thread John Zhang
*Sent:* Thursday, April 30, 2009 6:12 AM > *To:* Joshua Tolley > *Cc:* Adam Ruth; Pawel Socha; pgsql-sql@postgresql.org > *Subject:* Re: [SQL] Comparing two tables of different database > > > > Hi All, > > For example, > > There are two database. database1 and

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Jasen Betts
On 2009-04-29, Nicholas I wrote: > --000e0cd1d5062f2ca40468abd813 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > Hi, > > can anybody me suggest me, how to compare two tables of different > database. you want to use a join but can't... you need to get both

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Edward W. Rouse
l-sql-ow...@postgresql.org] On Behalf Of Nicholas I Sent: Thursday, April 30, 2009 6:12 AM To: Joshua Tolley Cc: Adam Ruth; Pawel Socha; pgsql-sql@postgresql.org Subject: Re: [SQL] Comparing two tables of different database Hi All, For example, There are two database. database1 and datab

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Joshua Tolley
On Thu, Apr 30, 2009 at 08:20:02AM +1000, Adam Ruth wrote: >The simple answer is to pg_dump both tables and compare the output with >diff. >Other than that, I think you'll need a custom program. For all but the strictest definition of "identical", that won't work. Tables may easily con

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Osvaldo Kussama
2009/4/29 Nicholas I : > >   can anybody me suggest me, how to compare two tables of different > database. > Two PostgreSQL databases: dblink http://www.postgresql.org/docs/current/interactive/dblink.html Distinct DBMS: dbilink http://pgfoundry.org/projects/dbi-link/ Osvaldo -- Sent via pgsql

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Nicholas I
Hi All, For example, There are two database. database1 and database 2; database1 has a table called pr_1 with the columns, id,name and time. database2 has a table called sr_1 with the_columns id,name and time. i would like to find out the differences that is, find the nam

Re: [SQL] Comparing two tables of different database

2009-04-30 Thread Jasen Betts
On 2009-04-29, Nicholas I wrote: > --000e0cd1d5062f2ca40468abd813 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > Hi, > > can anybody me suggest me, how to compare two tables of different > database. you probably want to use some sort of join. -- Sent via

Re: [SQL] Comparing two tables of different database

2009-04-29 Thread Adam Ruth
The simple answer is to pg_dump both tables and compare the output with diff. Other than that, I think you'll need a custom program. On 29/04/2009, at 10:33 PM, Pawel Socha wrote: 2009/4/29 Nicholas I : Hi, can anybody me suggest me, how to compare two tables of different database. -Nic

Re: [SQL] Comparing two tables of different database

2009-04-29 Thread Pavel Stehule
Hello try to look on http://pgfoundry.org/forum/forum.php?forum_id=1392 regards Pavel Stehule 2009/4/29 Nicholas I : > Hi, > >   can anybody me suggest me, how to compare two tables of different > database. > > -Nicholas I > -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] Comparing two tables of different database

2009-04-29 Thread Thomas Kellerer
Nicholas I, 29.04.2009 08:39: Hi, can anybody me suggest me, how to compare two tables of different database. Do you want to compare the data or the structure of the two tables? Thomas -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: htt

Re: [SQL] Comparing two tables of different database

2009-04-29 Thread Pawel Socha
2009/4/29 Nicholas I : > Hi, > >   can anybody me suggest me, how to compare two tables of different > database. > > -Nicholas I > what you mean 'different database' :) diffrent version, 2 instance ? Maybe this help: http://www.postgresql.org/docs/current/static/dblink.html -- Pawel Socha --

[SQL] Comparing two tables of different database

2009-04-29 Thread Nicholas I
Hi, can anybody me suggest me, how to compare two tables of different database. -Nicholas I