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