pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <akretschmer@despammed.com>
To: pgsql-sql@postgresql.org
Subject: Re: [despammed] Query two database at once
Date: Mon, 2 May 2005 19:51:41 +0200
Message-ID: <20050502175141.GP5962@webserv.wug-glas.de> (raw)
In-Reply-To: <427648E5.6080306@cerene.fr>
References: <427648E5.6080306@cerene.fr>

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    === 



view thread (2+ messages)

Message-ID: <20050502175141.GP5962@webserv.wug-glas.de>
Permalink:  ../20050502175141.GP5962@webserv.wug-glas.de/
Also on:    postgresql.org/message-id/20050502175141.GP5962@webserv.wug-glas.de

 · 

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: akretschmer@despammed.com
  Subject: Re: [despammed] Query two database at once
  In-Reply-To: <20050502175141.GP5962@webserv.wug-glas.de>

* 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