pgsql 主键添加自增

 

CREATE SEQUENCE 表名_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

alter table 表名 alter column id set default nextval('表名_id_seq');

 

posted @ 2020-04-29 14:17  timi小周  阅读(3521)  评论(0编辑  收藏  举报