public inbox for [email protected]
help / color / mirror / Atom feedSELECT last_value FROM sequence_name;
2+ messages / 2 participants
[nested] [flat]
* SELECT last_value FROM sequence_name;
@ 2021-04-12 08:47 PG Doc comments form <[email protected]>
2021-04-12 09:10 ` Re: SELECT last_value FROM sequence_name; Dave Cramer <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2021-04-12 08:47 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
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-inse...
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: SELECT last_value FROM sequence_name;
2021-04-12 08:47 SELECT last_value FROM sequence_name; PG Doc comments form <[email protected]>
@ 2021-04-12 09:10 ` Dave Cramer <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Cramer @ 2021-04-12 09:10 UTC (permalink / raw)
To: [email protected]; [email protected]
On Mon, 12 Apr 2021 at 04:50, PG Doc comments form <[email protected]>
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-inse...
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-04-12 09:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 08:47 SELECT last_value FROM sequence_name; PG Doc comments form <[email protected]>
2021-04-12 09:10 ` Dave Cramer <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox