I would like to force the auto increment field of a table to some value, I tried with this:
ALTER TABLE product AUTO_INCREMENT = 1453
AND
ALTER SEQUENCE product RESTART WITH 1453;
ERROR: relation "your_sequence_name" does not exist
I have a table product with Id and name field
If you created the table
productwith anidcolumn, then the sequence is not simply calledproduct, but ratherproduct_id_seq(that is,${table}_${column}_seq).This is the
ALTER SEQUENCEcommand you need:You can see the sequences in your database using the
\dscommand in psql. If you do\d productand look at the default constraint for your column, thenextval(...)call will specify the sequence name too.