Postgres: Get nextval in sequence without actually incrementing sequence?
17
votes
3
answers
46139
views
It looks like
select nextval('table_name')
actually does the value increment.
My goal is to "predict" the nextval
value on all tables in the database without actually making any incrementation. This should be a read-only operation.
I cannot run the select nextval
on a read-only connection since it's actually trying to make a transaction. I would like to be able to query this and monitor the sequences on a read-only replica database.
How would you tackle this and meet the goal?
Asked by emmdee
(357 rep)
Nov 12, 2019, 06:26 PM
Last activity: Apr 18, 2024, 02:27 PM
Last activity: Apr 18, 2024, 02:27 PM