0

I moved my existing MS SQL database to PostgreSQL containing 160000 records, now I am having issue setting my Primary Keys auto increment. I have created sequence but it starts from 1 that create duplicate value, I want to start PK value from max value existing already in table for example if existing PK value is 8568 i want to start my sequence from 8568 and same for all the other tables in database.

a_horse_with_no_name
  • 440,273
  • 77
  • 685
  • 758
Nafees Sardar
  • 63
  • 1
  • 10
  • In your [create sequence](https://www.postgresql.org/docs/10/sql-createsequence.html) specify START WITH **. – Belayer Mar 03 '20 at 18:49
  • In my case following Link works for me. https://stackoverflow.com/questions/46883392/postgres-update-primary-key-sequence-for-all-tables – Nafees Sardar Mar 17 '20 at 11:48

0 Answers0