Re: Transactions through dblink_exec() - Mailing list pgsql-hackers

From Mike Mascari
Subject Re: Transactions through dblink_exec()
Date
Msg-id 3DA90F88.1030807@mascari.com
Whole thread Raw
In response to Transactions through dblink_exec()  (Masaru Sugawara <rk73@sea.plala.or.jp>)
List pgsql-hackers
Masaru Sugawara wrote:
> Hi, all
> 
> While trying dblink_exec(), one of dblink()'s functions, I noticed there was an
> odd situation: case 1 and case 2 worked well, but case 3 didn't(see below). 
>  I hadn't been aware of it so that I only executed BEGIN and END in
> dblink_exec() at first . This time, however, I noticed it by executing ROLLBACK.
> 
> I'm hoping that dblink_exec() returns something like warning if those who intend
> to do transactions make a declaration of blink_exec('dbname=some', 'begin') by mistake.
> 
> for example 
>   WARNING :You should declare dblink_exec('dbname=some', 'BEGIN; some queries;
> COMMIT/ROLLBACK/END;') or use dblink_exec('BEGIN/COMMIT/ROLLBACK/END')
> around dblink_exec('some queries')s. If not, your transactions won't work.

How can dblink() possibly be used safely for non-readonly 
transactions without a full implementation of a two-phase commit 
protocol? What happens when the remote server issues the COMMIT 
and then the local server crashes?

Mike Mascari
mascarm@mascari.com



pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: pgsql 7.2.3 crash
Next
From: Joe Conway
Date:
Subject: Re: Transactions through dblink_exec()