NEXT VALUE FOR sequence

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Cc: hs(at)cybertec(dot)at
Subject: NEXT VALUE FOR sequence
Date: 2018-02-19 12:03:51
Message-ID: 1519041831.2503.15.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

This is an attempt to implement this on top of the recently introduced
NextValueExpr node.

If there is no obvious reason why we would not want that, I'll add it
to the next commitfest.

Is this behavior ok:

test=> CREATE SEQUENCE testseq;
test=> PREPARE x AS SELECT NEXT VALUE FOR testseq;
test=> EXECUTE x;
?column?
----------
1
(1 row)

test=> DROP SEQUENCE testseq;
DROP SEQUENCE
test=> EXECUTE x;
ERROR: could not open relation with OID 24836

If not, what could be done about it?

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Add-support-for-NEXT-VALUE-FOR-sequence.patch text/x-patch 14.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-02-19 12:06:51 Re: Prefix operator for text and spgist support
Previous Message David Rowley 2018-02-19 09:40:02 extern keyword incorrectly used in some function definitions