Skip to content

Instantly share code, notes, and snippets.

@SebKay
Created March 7, 2025 21:11
Show Gist options
  • Save SebKay/5373e5e39d735ddab77f4b77c42b289a to your computer and use it in GitHub Desktop.
Save SebKay/5373e5e39d735ddab77f4b77c42b289a to your computer and use it in GitHub Desktop.
Fix PostresSQL sequence out of order
SELECT SETVAL((SELECT PG_GET_SERIAL_SEQUENCE('"table"', 'id')), (SELECT (MAX("id") + 1) FROM "table"), FALSE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment