Re: SET autocommit begins transaction?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sean Chittenden <sean(at)chittenden(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: SET autocommit begins transaction?
Date: 2002-09-18 22:15:13
Message-ID: 200209182215.g8IMFDL02241@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom Lane wrote:
> >> Sean Chittenden <sean(at)chittenden(dot)org> writes:
> >>> Does turnning autocommit off enter you into a transaction? Am I
> >>> smoking something or does that seems broken?
>
> > Tom, do you want to special case autocommit? I think that would be OK.
>
> No, I don't like that either ... in general I do not think SET's
> behavior should vary depending on which variable is being set.

Yep, this is where we got lost before. You don't want to special case
SET variables, but you _do_ want to special case SET at the start of a
transaction. Did you see my timeout example? How is that supposed to
be handled cleanly?

SET statement_timeout = 20;
query generates error;
SET statement_timeout = 0;
COMMIT;

If the first SET doesn't start a transaction and isn't part of the
transaction, I don't see how to do this. Maybe:

BEGIN;
SET statement_timeout = 20;
query generates error;
SET statement_timeout = 0;
COMMIT;

So then you have to train people that their initial SET isn't part of
the transaction, though the later one is. Yuck.

I think we diverted from the spec when we went with making SET
rollbackable and now we are seeing the problems caused.

Why exactly did you want the initial SET to not be part of the
transaction?

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-09-18 22:18:00 Re: SET autocommit begins transaction?
Previous Message Sean Chittenden 2002-09-18 22:11:27 Re: SET autocommit begins transaction?