Incorrect START TRANSACTION implementation

Started by Peter Eisentrautalmost 22 years ago3 messages
#1Peter Eisentraut
peter_e@gmx.net

SQL99 part 2 clause 16.1 contains this note:

NOTE 327 - The characteristics of a transaction begun by a
<start transaction statement> are as specified in these General
Rules regardless of the characteristics specified by any
preceding <set transaction statement>. That is, even if one
or more characteristics are omitted by the <start transaction
statement>, the defaults specified in the Syntax Rules of this
Subclause are effective and are not affected by any (preceding)
<set transaction statement>.

In other words, this should work:

peter=# set session characteristics as transaction read only;
SET
peter=# start transaction;
START TRANSACTION
peter=# create table test (a int);
ERROR: transaction is read-only

because the default of a bare "start transaction" is read write. I
propose that we change this to follow the standard and keep the
traditional behavior for BEGIN only.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Incorrect START TRANSACTION implementation

Peter Eisentraut <peter_e@gmx.net> writes:

SQL99 part 2 clause 16.1 contains this note:
NOTE 327 - The characteristics of a transaction begun by a
<start transaction statement> are as specified in these General
Rules regardless of the characteristics specified by any
preceding <set transaction statement>. That is, even if one
or more characteristics are omitted by the <start transaction
statement>, the defaults specified in the Syntax Rules of this
Subclause are effective and are not affected by any (preceding)
<set transaction statement>.

In other words, this should work:

peter=# set session characteristics as transaction read only;
SET
peter=# start transaction;
START TRANSACTION
peter=# create table test (a int);
ERROR: transaction is read-only

Are you sure you're reading that correctly? It says <set transaction
statement> not <set session characteristics statement>. What use would
SET SESSION CHARACTERISTICS have at all, if it's ignored by START
TRANSACTION?

It appears to me that the spec is saying that *this* should work:

regression=# set transaction read only;
SET
regression=# start transaction;
START TRANSACTION
regression=# create table test (a int);
CREATE TABLE

... which it does.

regards, tom lane

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#2)
Re: Incorrect START TRANSACTION implementation

Tom Lane wrote:

Are you sure you're reading that correctly?

Not anymore... :-/ Sorry for the noise. I had remembered that in some
context <set transaction> and <set session characteristics> were
interchangeable, but apparently I got it all mixed up.