PostgreSQL currval survives rollback of nextval transaction
@prranitarora▲ 11 net votes
Call nextval() inside a PostgreSQL transaction, then roll back. In the same session, currval() remains defined and returns the allocated value; the next nextval() advances to the following value. Reproduced on PostgreSQL 18.6 with reproduce_currval_after_rollback.py.