Обсуждение: savepoint name vs prepared transaction name

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

savepoint name vs prepared transaction name

От
Grzegorz Jaśkiewicz
Дата:
Is there any reason, why I can't put quotes around name of savepoint, but I have/can do this for prepare transaction ?

Ie:
SAVEPOINT 'foo'; --- doesn't work
SAVEPOINT foo; --- all grand

PREPARE TRANSACTION 'foo'; --- grand
PREPARE TRANSACTION foo; refuses to work.

It is quite confusing, I feel like some consistency would be nice here.


--
GJ

Re: savepoint name vs prepared transaction name

От
Tom Lane
Дата:
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= <gryzman@gmail.com> writes:
> Is there any reason, why I can't put quotes around name of savepoint, but I
> have/can do this for prepare transaction ?

Savepoint names are identifiers; the SQL spec says so.  Prepared
transaction GIDs are string literals.  The relevant discussion
about that is here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01292.php

We could conceivably allow an identifier too in PREPARE TRANSACTION,
but I think that that might be more dangerous than helpful, because
of the implicit case folding for identifiers.  'XX' and 'xx' are
distinct but XX and xx wouldn't be.  There are a few other places
where we allow strings and identifiers interchangeably, but AFAIR
they are all places where case doesn't matter.

            regards, tom lane

Re: savepoint name vs prepared transaction name

От
Grzegorz Jaśkiewicz
Дата:


2009/10/16 Tom Lane <tgl@sss.pgh.pa.us>
Grzegorz Jaśkiewicz <gryzman@gmail.com> writes:
> Is there any reason, why I can't put quotes around name of savepoint, but I
> have/can do this for prepare transaction ?

Savepoint names are identifiers; the SQL spec says so.  Prepared
transaction GIDs are string literals.  The relevant discussion
about that is here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01292.php

We could conceivably allow an identifier too in PREPARE TRANSACTION,
but I think that that might be more dangerous than helpful, because
of the implicit case folding for identifiers.  'XX' and 'xx' are
distinct but XX and xx wouldn't be.  There are a few other places
where we allow strings and identifiers interchangeably, but AFAIR
they are all places where case doesn't matter.

makes sense. Cheers Tom.



--
GJ