Incorrect START TRANSACTION implementation

Поиск
Список
Период
Сортировка
Искать

Incorrect START TRANSACTION implementation

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
SQL99 part 2 clause 16.1 contains this note:
   NOTE 327 - The characteristics of a transaction begun by a    are as specified in these General   Rules regardless of the characteristics specified by any   preceding . That is, even if one   or more characteristics are omitted by the , the defaults specified in the Syntax Rules of this   Subclause are effective and are not affected by any (preceding)   .

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.


Re: Incorrect START TRANSACTION implementation

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut  writes:
> SQL99 part 2 clause 16.1 contains this note:
>     NOTE 327 - The characteristics of a transaction begun by a
>      are as specified in these General
>     Rules regardless of the characteristics specified by any
>     preceding . That is, even if one
>     or more characteristics are omitted by the      statement>, the defaults specified in the Syntax Rules of this
>     Subclause are effective and are not affected by any (preceding)
>     .

> 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  not .  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

Re: Incorrect START TRANSACTION implementation

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Tom Lane wrote:
> Are you sure you're reading that correctly?

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


FAQ