Thursday, May 16, 2019

Reset a PostgreSQL sequence and update column values

  No comments
this can re-increment value of table on postgre

Example your table like that



SOLUTION

UPDATE public.migrations SET id=10000+nextval('public.migrations_id_seq');
ALTER SEQUENCE public.migrations_id_seq RESTART WITH 1;
UPDATE public.migrations SET id=nextval('public.migrations_id_seq');



No comments :

Post a Comment