PostgreSQL 没有Sqlserver自增标识,需要通过sequence实现字段值的自增公共。具体新建sequence及创建自增列的脚本如下:
–新建sequenc
create sequence if not exists i_interfaceinfoin_id_seq increment by 1 minvalue 1 no maxvalue ;
— 设置启始值
select setval('i_interfaceinfoin_id_seq ', 172905);
– 检查sequence是否正确
SELECT nextval(‘i_interfaceinfoin_id_seq’)
–将sequence指定到对应的字段
alter table i_interfaceinfoin alter column “id” set default nextval(‘i_interfaceinfoin_id_seq’);
其他参考语句
– CREATE SEQUENCE if not exists i_interfaceinfoout_id_seq INCREMENT 1
– 删除squence
drop sequence if exists i_interfaceinfoout_id_seq
SELECT MAX(id) FROM i_interfaceinfoin —166434
– alter sequence i_interfacecase_id_seq start with 166435;