Guest User

Untitled

a guest
Jun 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. # After an import of data sometimes when you try to create new records, postgres creates same ids and cause clashes from time to time
  2. # To correct the sequence and tell postgres where to start counting next run this
  3.  
  4.  
  5. SELECT pg_catalog.setval(pg_get_serial_sequence('table_name', 'id'), MAX(id)) FROM table_name; # replace table_name with required table
Add Comment
Please, Sign In to add comment