Skip to content

Instantly share code, notes, and snippets.

@tinnet
Created May 24, 2013 15:20
Show Gist options
  • Save tinnet/5644263 to your computer and use it in GitHub Desktop.
Save tinnet/5644263 to your computer and use it in GitHub Desktop.
cursor = db.connection.cursor()
# borrowed from http://goo.gl/BWxNj
seq_fix_sql = """SELECT setval('django_messages_message_id_seq', coalesce((select max(id)+1 from django_messages_message), 1), true)"""
cursor.execute(seq_fix_sql)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment