(编辑:jimmy 日期: 2024/12/27 浏览:2)
(从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')
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。如有错误或未考虑完全的地方,望不吝赐教。