Re: Nested xacts: looking for testers and review

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Nested xacts: looking for testers and review
Дата
Msg-id 20040609192710.GA10705@dcc.uchile.cl
обсуждение исходный текст
Ответ на Re: Nested xacts: looking for testers and review  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Nested xacts: looking for testers and review  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Nested xacts: looking for testers and review  (Barry Lind <blind@xythos.com>)
Список pgsql-hackers
On Fri, May 28, 2004 at 04:05:40PM -0400, Bruce Momjian wrote:

Bruce,

> One interesting idea would be for COMMIT to affect the outer
> transaction, and END not affect the outer transaction.  Of course that
> kills the logic that COMMIT and END are the same, but it is an
> interesting idea, and doesn't affect backward compatibility because
> END/COMMIT behave the same in non-nested transactions.

I implemented this behavior by using parameters to COMMIT/END.  I didn't
want to add new keywords to the grammar so I just picked up
"COMMIT WITHOUT ABORT".  (Originally I had thought "COMMIT IGNORE
ERRORS" but those would be two new keywords and I don't want to mess
around with the grammar.  If there are different opinions, tweaking the
grammar is easy).

So the behavior I originally implemented is still there:

alvherre=# begin;
BEGIN
alvherre=# begin;
BEGIN
alvherre=# select foo;
ERROR:  no existe la columna "foo"
alvherre=# commit;
COMMIT
alvherre=# select 1;
ERROR:  transacción abortada, las consultas serán ignoradas hasta el fin de bloque de transacción
alvherre=# commit;
COMMIT


However if one wants to use in script the behavior you propose, use
the following:

alvherre=# begin;
BEGIN
alvherre=# begin;
BEGIN
alvherre=# select foo;
ERROR:  no existe la columna "foo"
alvherre=# commit without abort;
COMMIT
alvherre=# select 1;
 ?column?
----------
        1
(1 fila)

alvherre=# commit;
COMMIT


The patch is attached.  It applies only after the previous patch,
obviously.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Ciencias políticas es la ciencia de entender por qué
los políticos actúan como lo hacen"  (netfunny.com)

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: pgsql@mohawksoft.com
Дата:
Сообщение: Re: sequences and "addval('myseq', value)"
Следующее
От: craig perras
Дата:
Сообщение: transaction aborts in SPI