Re: [despammed] Query two database at once

From: Andreas Kretschmer <akretschmer(at)despammed(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [despammed] Query two database at once
Date: 2005-05-02 17:51:41
Message-ID: 20050502175141.GP5962@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ===

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message lucas 2005-05-02 19:10:46 Record Log Trigger
Previous Message Joel Fradkin 2005-05-02 17:49:29 odd error