Skip to content

Instantly share code, notes, and snippets.

@mretzak
Created March 19, 2014 14:06
Show Gist options
  • Save mretzak/9642321 to your computer and use it in GitHub Desktop.
Save mretzak/9642321 to your computer and use it in GitHub Desktop.
Check and reset primary key sequence for Big South survey_question_options
-- find highest ID value
SELECT MAX(id) FROM survey_question_options;
-- check next value in auto-incrementing sequence
SELECT nextval('survey_question_options_id_seq');
-- if they are not in sync, reset sequence at highest ID + 1
SELECT setval('survey_question_options_id_seq', (SELECT MAX(id) FROM survey_question_options)+1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment