Skip to content

Instantly share code, notes, and snippets.

@ilovejs
Created September 26, 2015 14:07
Show Gist options
  • Save ilovejs/d2eb1c8d8bab7328e01a to your computer and use it in GitHub Desktop.
Save ilovejs/d2eb1c8d8bab7328e01a to your computer and use it in GitHub Desktop.
alter column to be serial
CREATE SEQUENCE "temp1_id_seq" OWNED BY "Temp1". ID;
ALTER TABLE "Temp1" ALTER COLUMN ID
SET DEFAULT nextval('temp1_id_seq');
COMMIT;
--Temp1 is table name, however, sequence name must be low-cased.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment