Re: [despammed] Query two database at once - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: [despammed] Query two database at once
Date
Msg-id 20050502175141.GP5962@webserv.wug-glas.de
Whole thread Raw
In response to Query two database at once  (Stéphane RIFF <stephane.riff@cerene.fr>)
List pgsql-sql
am  02.05.2005, um 17:36:05 +0200 mailte Stéphane RIFF folgendes:
> Hi,
> 
> I want to ewecute a query on two database like this :
> 
> SELECT * FROM table01 T1, table02 T2 WHERE T1.gid=T2.gid AND 
> T2.my_field='".$value."'
> 
> The problem is that table01 is in a different database than table02 and i 
> don't know how to telle postgresql
> to look in two db.
> Is there a solution other than execute two query ?

The answer is: yes and no.

No: PG can't connect to two databases and do a select across.
Yes: take a look at the contrib on dblink.

You should look in the archiv of the list, Tom Lane and other people
described the way with dblink in the past.


Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net===    Schollglas Unternehmensgruppe    === 


pgsql-sql by date:

Previous
From: "Joel Fradkin"
Date:
Subject: odd error
Next
From: lucas@presserv.org
Date:
Subject: Record Log Trigger