Thursday, March 5, 2026

How to find the current value for a PostgreSQL sequence

SELECT last_value FROM myschema.mysequence;
or
SELECT nextval('myschema.mysequence');
Note: nextval() advances the sequence — use last_value if you just want to inspect without side effects.

No comments:

Post a Comment