Skip to content

Instantly share code, notes, and snippets.

@laozhu
Created October 25, 2013 03:57
Show Gist options
  • Save laozhu/7149256 to your computer and use it in GitHub Desktop.
Save laozhu/7149256 to your computer and use it in GitHub Desktop.
解决postgresql下的主键冲突问题
SELECT setval('tablename_id_seq', (SELECT MAX(id) FROM tablename)+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment