0

I want to set primary value to start with 1000 in postgres.

i know a command in mysql

ALTER TABLE tablename AUTO_INCREMENT = 1000

how to write the above mysql command in postgres ?

1 Answer 1

1

identity (and the somewhat outdated serial) columns are based on sequences.

You can set the sequence associated with such a column using setval()

select setval(pg_get_serial_sequence('table_name', 'column_name'), 1000);
Sign up to request clarification or add additional context in comments.

2 Comments

serial is outdated? what is alternate to use?
@Curious: as I wrote: identity columns. See here for details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.