Re: A bad behavior under autocommit off mode - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: A bad behavior under autocommit off mode
Date
Msg-id 200303200237.h2K2bnU28282@candle.pha.pa.us
Whole thread Raw
In response to Re: A bad behavior under autocommit off mode  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-hackers
Hiroshi Inoue wrote:
> Bruce Momjian wrote:
> > 
> > OK, I have a patch to fix this bug.  The basic problem is that when a
> > multi-query string is passed to the backend, it is treated as a single
> > transaction _unless_ a transaction or GUC command appears in the string.
> > When they appear, a transaction is forced, but the normal transaction
> > state machine has been bypassed, meaning in:
> > 
> >         SET autocommit TO off; SELECT 1; COMMIT;
> > 
> > when the COMMIT arrives, the transaction state machines hasn't seen the
> > SELECT because the mechanism is bypassing the state machine to try and
> > get everything into the same transaction.
> > 
> > This patch removes that "stuff all queries into a single transaction"
> > behavior and makes them function just like queries arriving separately.
> > This does BREAK BACKWARD COMPATIBILITY.  However, if they want the old
> > behavior, they just need to wrap BEGIN/COMMIT around the query string.
> 
> Does the change worth the trouble ?
> Please don't break BACKWARD COMPATIBILITY easily.

It clearly fixes an existing bug, and I asked on general to see if
anyone has any problem with the change.  My guess is that more people
are surprised by the group-string-as-a-single-transaction as people who
use the feature, so I see it as the removal of surprising functionality.

We will mention it in the release notes, and I can even supply a patch
for those who want it kept.  In fact, I can easily make it a compile
option --- the change is only a single conditional test.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Open 7.4 features
Next
From: Tom Lane
Date:
Subject: Re: Nested transactions: low level stuff