Excerpts from Robert Haas's message of mar ago 16 09:59:04 -0400 2011:
> On Mon, Aug 15, 2011 at 6:46 PM, Joachim Wieland <j...@mcknight.de> wrote:

> > Also see what Robert wrote about proxies in between that keep track
> > of the transaction state. Consider they see a BEGIN query that
> > fails. How would they know if the session is now in an aborted
> > transaction or not in a transaction at all?
> I think the point here is that we should be consistent.  Currently,
> you can make BEGIN fail by doing it on the standby, and asking for
> READ WRITE mode:
> rhaas=# begin transaction read write;
> ERROR:  cannot set transaction read-write mode during recovery
> After doing that, you are NOT in a transaction context:
> rhaas=# select 1;
>  ?column?
> ----------
>         1
> (1 row)
> So whatever this does should be consistent with that, at least IMHO.

I think we argued about a very similar problem years ago and the outcome
was that you should be left in an aborted transaction block; otherwise
running a dumb SQL script (which has no way to "abort if it fails")
could wreak serious havoc (?).  I think this failure to behave in that
fashion on the standby is something to be fixed, not imitated.

What this says is that a driver or app seeing BEGIN fail should issue
ROLLBACK before going further -- which seems the intuitive way to behave
to me.  No?

Álvaro Herrera <alvhe...@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to