Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 2DF7C9FB80B for ; Wed, 8 Aug 2007 23:49:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 22523-05 for ; Wed, 8 Aug 2007 23:49:15 -0300 (ADT) X-Greylist: delayed 00:12:05.553131 by SQLgrey-1.7.5 Received: from boston.agmednet.com (boston.agmednet.com [74.92.47.82]) by postgresql.org (Postfix) with ESMTP id 392299FBFAB for ; Wed, 8 Aug 2007 23:48:54 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from 71.233.123.244 ([71.233.123.244]) by agmednet-dc.boston.agmednet.local ([192.168.67.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 9 Aug 2007 02:22:50 +0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7DA2C.2F240C3A" User-Agent: Microsoft-Entourage/11.3.6.070618 Content-class: urn:content-classes:message Subject: Joining tables in two different databases? Date: Wed, 8 Aug 2007 22:22:50 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Joining tables in two different databases? thread-index: AcfaLeHMICTDMEYhEdyamgAX8gFv1g== From: "Michael Goldner" To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.485 tagged_above=0 required=5 tests=AWL=0.527, BAYES_05=-1.11, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=2.067 X-Spam-Level: * X-Archive-Number: 200708/96 X-Sequence-Number: 26427 This is a multi-part message in MIME format. ------_=_NextPart_001_01C7DA2C.2F240C3A Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is it possible to access tables in two different databases, running on = the same server, from within psql? I have a table in a database that is "linked" to a table in another = database (using XA transactions in Jboss). I'd like to do some archiving at the database level, which requires that for every record in db1.table1, I = need to archive the corresponding record in db2.table1. I seem to recall using some other rdbms in the past that allowed one to prefix the table name with the dbname. Can this be done in postgres? If not, it seems that I'll need to do some sort of "COPY" operation to export the primary keys to a temporary table, import it into the second = db, and then perform my archive based on the table. Does this seem = appropriate? Otherwise, I could write the archive procedure in Java, using the XA datasource. I was hoping to avoid the overhead and complexity involved versus a succinct sql statement. Thanks! ------_=_NextPart_001_01C7DA2C.2F240C3A Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Joining tables in two different databases?

Is it possible to access tables in two different = databases, running on the
same server, from within psql?

I have a table in a database that is "linked" to a table in = another database
(using XA transactions in Jboss).  I'd like to do some archiving at = the
database level, which requires that for every record in db1.table1, I = need
to archive the corresponding record in db2.table1.

I seem to recall using some other rdbms in the past that allowed one = to
prefix the table name with the dbname.  Can this be done in = postgres?

If not, it seems that I'll need to do some sort of "COPY" = operation to
export the primary keys to a temporary table, import it into the second = db,
and then perform my archive based on the table.  Does this seem = appropriate?

Otherwise, I could write the archive procedure in Java, using the XA
datasource.  I was hoping to avoid the overhead and complexity = involved
versus a succinct sql statement.

Thanks!


------_=_NextPart_001_01C7DA2C.2F240C3A--