SELECT last_value FROM sequence_name;
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/13/functions-sequence.html Description: Please add Note, how to get the (global) last value: SELECT last_value FROM sequence_name; https://dba.stackexchange.com/questions/3281/how-do-i-use-currval-in-postgresql-to-get-the-last-inserted-id
Re: SELECT last_value FROM sequence_name;
On Mon, 12 Apr 2021 at 04:50, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/13/functions-sequence.html > Description: > > Please add Note, how to get the (global) last value: > SELECT last_value FROM sequence_name; > > https://dba.stackexchange.com/questions/3281/how-do-i-use-currval-in-postgresql-to-get-the-last-inserted-id The reason this is not added is that it is incorrect to use the sequence this way. How do you know which session incremented it, or if it has been incremented since the last use ? The correct way to use a sequence is to increment it and then use currval or the like Dave Cramer www.postgres.rocks
Re: repeated info in sections 4.1.1, 4.1.2.3
On Sun, Apr 11, 2021 at 07:40:48PM +, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/13/sql-syntax-lexical.html > Description: > > Simply want to tell you that there is repeated almost word-in-word info in > 4.1.1 (starting with "A variant of quoted identifiers allows including", > ending with "If the server encoding is not UTF-8, the Unicode code point") > and in 4.1.2.3 (starting with "PostgreSQL also supports another type of > escape syntax", ending with "If the server encoding is not UTF-8, the > Unicode code point") sections of documentation of PostgreSQL 13 current > version. Well, one section is about identifiers, and other about SQL strings. I can't think of how to improve this. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.