时间:2021-06-04 07:55:47 | 栏目:PostgreSQL | 点击:次
(从1开始,递增幅度1,最大值无上限):
create sequence fl_user_seq increment by 1 minvalue 1 no maxvalue start with 1;
(方法中两个参数分别是1.序列名字,2.序列修改后值):
select setval('fl_user_seq ', 88);
Navicat Premium中序列位置如下图:
补充:PostgreSQL 序列增删改
CREATE SEQUENCE if not exists test_mergetable_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 999999999 START 1 CACHE 1; //或者: create sequence if not exists test_mergetable_id_seq increment by 1 minvalue 1 no maxvalue start with 1;
alter table test_mergetable alter column "i_id" set default nextval('test_mergetable_id_seq');
SELECT setval('test_mergetable_id_seq', (SELECT MAX(i_id) FROM test_mergetable)); alter sequence test_mergetable_id_seq start with 12;
drop sequence IF EXISTS test_mergetable_id_seq
SELECT nextval('test_mergetable_id_seq')