In Postgres auto incrementing primary keys are defined using SERIAL PRIMARY KEY. These primary keys are tied to a sequence when defined and hence we need to ALTER the sequence . . .
ALTER SEQUENCE ca_kw_kw_id_seq RESTART WITH 1;
UPDATE ca_kw SET kw_id=nextval('ca_kw_kw_id_seq');
ALTER SEQUENCE ca_kw_kw_id_seq RESTART WITH 1;
UPDATE ca_kw SET kw_id=nextval('ca_kw_kw_id_seq');