Re: NEXT VALUE FOR sequence

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: NEXT VALUE FOR sequence
Дата
Msg-id 759ae1b7-543c-4f38-9bc9-cbe773cbe5ef@manitou-mail.org
обсуждение исходный текст
Ответ на NEXT VALUE FOR sequence  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
    Laurenz Albe wrote:

> The SQL standard has the expression "NEXT VALUE FOR asequence" to do
> what we traditionally do with "nextval('asequence')".

The behavior mandated by the standard is that several invocations
of NEXT VALUE on the same sequence on the same output row
must produce the same value. That is:

CREATE SEQUENCE s;
SELECT NEXT VALUE FOR s, NEXT VALUE FOR s
 UNION
SELECT NEXT VALUE FOR s, NEXT VALUE FOR s

should produce
(1,1)
(2,2)

It makes sense that the value does not depend on
the position of the expression as a column.

The trouble of course is that the equivalent with
nextval() would produce instead
(1,2)
(3,4)


There have been previous discussions on the standard syntax
that said that when it will get into postgres, it should go with
the standard conforming semantics.
I guess it would be a much more difficult patch.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


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

Предыдущее
От: Alexander Levsha
Дата:
Сообщение: Tracking object modification time using event triggers
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] path toward faster partition pruning