Relative Content

Tag Archive for sqlpostgresqlsequence

How to get id from sequence without nextval() in postgres?

I’m trying to figure out how to insert new data into a database while explicitly setting the ID. However, when I use nextval('user_seq'), it doesn’t retrieve the next value from the sequence as expected; instead, it increments it based on the value I inserted earlier:
demo at db<>fiddle