From 657c098e41b0bb29d30d13d9aa1ac858a07f3493 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Tue, 7 Jun 2005 07:08:35 +0000 Subject: Add a function lastval(), which returns the value returned by the last nextval() or setval() performed by the current session. Update the docs, add regression tests, and bump the catalog version. Patch from Dennis Björklund, various improvements by Neil Conway. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/src/sgml/func.sgml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 5bd29793e81..7eb2c4c6b13 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -6487,6 +6487,9 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT currval + + lastval + setval @@ -6519,6 +6522,12 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT currval(text) bigint + Return value most recently obtained with + nextval for specified sequence + + + lastval() + bigint Return value most recently obtained with nextval @@ -6587,6 +6596,22 @@ nextval('foo') searches search path for fo + + lastval + + + Return the value most recently returned by + nextval in the current session. This function is + identical to currval, except that instead + of taking the sequence name as an argument it fetches the + value of the last sequence that nextval + was used on in the current session. It is an error to call + lastval if nextval + has not yet been called in the current session. + + + + setval -- cgit v1.2.3