由于分库,需要配置某一个数据包起始位置。 比如a数据库起始1开始,比数据库起始1000开始
create table if not exists "public"."IdCards"
(
"id" bigserial
constraint IdCards_pk
primary key,
"coordinate" integer,
"registerTime" timestamp without time zone null default now(),
"updateTime" timestamp without time zone null ,
"removeTime" timestamp without time zone null
);
comment on table "IdCards" is '身份证表';
comment on column "public"."IdCards"."id" is '编号';
truncate "public"."IdCards";
DELETE FROM "public"."IdCards" where true;
select setval('"IdCards_id_seq"',100000, false) from "public"."IdCards";
-- select setval('"IdCards_id_seq"',1, false) from "public"."IdCards";
-- alter sequence "IdCards_id_seq" restart with 1 OWNED BY "public"."IdCards".id;
insert into "public"."IdCards" (coordinate)
values
(0);
select * from "IdCards";
-- select * from pg_tables;
-- d "public".IdCards
如上数据库脚本... alter sequence
是可以立即生效的,但是select setval('"IdCards_id_seq"',1, false)
没有立即生效...
但是我看别人电脑都是好好的.... wuwuwu
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…