X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF09A52A2D for ; Mon, 2 May 2005 14:50:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66102-01 for ; Mon, 2 May 2005 17:50:45 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id AED45539E6 for ; Mon, 2 May 2005 14:50:44 -0300 (ADT) Received: from [212.227.126.207] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1DSf48-0002Qt-00 for pgsql-sql@postgresql.org; Mon, 02 May 2005 19:50:44 +0200 Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1DSf48-0006Tk-00 for pgsql-sql@postgresql.org; Mon, 02 May 2005 19:50:44 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.35 #1) id 1DSf53-0005kD-00 for pgsql-sql@postgresql.org; Mon, 02 May 2005 19:51:41 +0200 Date: Mon, 2 May 2005 19:51:41 +0200 From: Andreas Kretschmer To: pgsql-sql@postgresql.org Subject: Re: [despammed] Query two database at once Message-ID: <20050502175141.GP5962@webserv.wug-glas.de> Mail-Followup-To: Andreas Kretschmer , pgsql-sql@postgresql.org References: <427648E5.6080306@cerene.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <427648E5.6080306@cerene.fr> X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: The Windows platform is not just insecure - it's patently, blatantly, and unashamedly insecure by design. X-PrivatMail: kretschmer@kaufbach.delug.de X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.334 tagged_above=0 required=5 tests=AWL, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH X-Spam-Level: X-Archive-Number: 200505/21 X-Sequence-Number: 21334 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 ===