建立主键并设置自动增加的办法好好几种,这里记录我测试过的:
drop table pro_process;
CREATE TABLE "public"."pro_process" (
"id" SERIAL primary key, //设置主键并自动增长
"county_code" varchar(6) COLLATE "default" NOT NULL,
"county_name" varchar(50) COLLATE "default" NOT NULL,
"creator" varchar(100) COLLATE "default" NOT NULL,
"create_time" date NOT NULL
)
WITH (OIDS=FALSE)
;
ALTER TABLE "public"."pro_process" OWNER TO "postgres";
参考: