方法一:添加序列,然后设置主键自增
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
alter table 表名 alter column 字段名 set default nextval('users_id_seq');
方法一:添加序列,然后设置主键自增
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
alter table 表名 alter column 字段名 set default nextval('users_id_seq');