Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EB90C9FA559 for ; Thu, 11 Oct 2007 15:54:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 21545-03-3 for ; Thu, 11 Oct 2007 15:54:16 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 86C5D9FB9FA for ; Thu, 11 Oct 2007 15:54:05 -0300 (ADT) thread-index: AcgMOCGAndrGDI3LQT+xpayXuk60MA== Received: from [192.168.1.33] ([86.0.119.30]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Oct 2007 14:54:19 -0400 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4073 Content-class: urn:content-classes:message Message-ID: <470E70D1.2020906@enterprisedb.com> Importance: normal Date: Thu, 11 Oct 2007 19:52:01 +0100 From: "Heikki Linnakangas" User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: "Brian Oki \(boki\)" Cc: Subject: Re: Support for distributed transactions References: <5FDF17E5F815DD429DBA1B1C2159DC0344E5A4@xmb-sjc-239.amer.cisco.com> In-Reply-To: <5FDF17E5F815DD429DBA1B1C2159DC0344E5A4@xmb-sjc-239.amer.cisco.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Oct 2007 18:54:19.0765 (UTC) FILETIME=[215F3A50:01C80C38] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/78 X-Sequence-Number: 17650 Brian Oki (boki) wrote: > It is unclear to me how SQL statements can be executed at remote nodes > from a single coordinator and then use distributed two-phase commit (via > 'prepare transaction tid' and 'commit prepared'). I worked at Oracle in > the distributed database group and could do things like the following > using PL/SQL, where we insert the same row into the same table on three > different nodes, including the local one: > insert into foo .... > insert into foo@node2.acme.com > .... > insert into foo@node3.acme.com .... > COMMIT > This sequence will insert a row into all three tables and do the > distributed atomic commitment. > > My question is this: How does PostgreSQL 8.2.5 execute DML statements > (insert, update, delete, select) on remote nodes as part of the same > transaction? Where is the syntax specified? Unfortunately PostgreSQL doesn't have remote or federated queries like that. You can't reference tables in different nodes. PostgreSQL does support two-phase commit, but what you're looking for is much more than that. There is, however, a contrib module called dblink, that you can use to submit SQL queries to remote database, but it's not integrated so that you could do "INSERT foo@remotenode". By using dblink in update rules on a view you can emulate that to some extent. But dblink won't do two-phase commit, so you'll find that the updates to remote tables are committed as soon as the statement finishes. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com