Thread: SAVEPOINT syntax again

SAVEPOINT syntax again

From
Oliver Jowett
Date:
Against CVS HEAD:

> test=# select version();
>                                             version                                            
> -----------------------------------------------------------------------------------------------
>  PostgreSQL 8.0.0beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 (Debian 20040401)
> (1 row)
> 
> test=# begin;
> BEGIN
> test=# savepoint foo;
> SAVEPOINT
> test=# rollback to foo;
> ROLLBACK
> test=# rollback to savepoint foo;
> ERROR:  syntax error at or near "foo" at character 23
> LINE 1: rollback to savepoint foo;
>                               ^
> test=# rollback;
> ROLLBACK

> test=# begin;
> BEGIN
> test=# savepoint foo;
> SAVEPOINT
> test=# release foo;
> RELEASE
> test=# savepoint foo;
> SAVEPOINT
> test=# release savepoint foo;
> ERROR:  syntax error at or near "foo" at character 19
> LINE 1: release savepoint foo;
>                           ^

Comments:

1) We have a different syntax to the SQL200n draft (and Oracle by the 
looks of it) for ROLLBACK. The draft says:

> <rollback statement> ::= ROLLBACK [ WORK ] [ AND [ NO ] CHAIN ] [ <savepoint clause> ]
> <savepoint clause> ::= TO SAVEPOINT <savepoint specifier>

2) We have a different syntax for RELEASE too. The SQL200n draft says:

> <release savepoint statement> ::= RELEASE SAVEPOINT <savepoint specifier>

3) Can the command tag for a ROLLBACK TO SAVEPOINT be different to the 
command tag for a global rollback, so clients can distinguish the two 
cases? ("ROLLBACK <savepoint specifier>" might be nice)

-O