1.新建表
CREATE TABLE "public"."t_test" (
"id" int4 NOT NULL,
"name" varchar(255) COLLATE "default",
CONSTRAINT "t_test_pkey" PRIMARY KEY ("id")
)
WITH (OIDS=FALSE)
;
ALTER TABLE "public"."t_test" OWNER TO "postgres";
COMMENT ON COLUMN "public"."t_test"."id" IS
COMMENT ON COLUMN "public"."t_test"."name" IS
2.新建序列
CREATE SEQUENCE "public"."t_test_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 2
CACHE 1;
ALTER TABLE "public"."t_test_id_seq" OWNER TO "postgres";
SELECT setval('"public"."t_test_id_seq"', 2, true);
3.设置表的主键为序列的下一个值:通过Navicat设置