Re: BUG #3240: Unexpected evaluation sequence

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #3240: Unexpected evaluation sequence
Дата
Msg-id 16887.1177045137@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #3240: Unexpected evaluation sequence  ("Kevin Macdonald" <kevin.macdonald@pentura.ca>)
Список pgsql-bugs
"Kevin Macdonald" <kevin.macdonald@pentura.ca> writes:
> Now, take these two operations:

> SQL> select currval ('seq')

> returns 11

> SQL> select nextval ('seq'), currval ('seq')

> returns (12, 12)

> I would have expected it to have returned (12, 11).

No, because currval reports the latest nextval result in your session,
and the nextval has already been executed.  This is dependent on order
of execution of select-list items, but at the moment that's always
left-to-right.

> It seems that the value
> of currval above should have been the value immediately before the SQL
> statement was executed -- a value of 11.

Since sequence operations are non-transactional by definition, I'm not
really sure why you'd expect that.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3245: PANIC: failed to re-find shared lock object
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3243: foreign key constraint not working?