查询表自增主键
SELECT column_name, column_default
FROM information_schema.columns
WHERE table_name = 'sys_deploy_form'
AND column_default LIKE 'nextval%';
创建序列
CREATE SEQUENCE "PUBLIC"."sys_deploy_form_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
将序列给表
ALTER SEQUENCE "PUBLIC"."sys_deploy_form_seq" OWNED BY "PUBLIC"."sys_deploy_form"."id";
将表的主键大小给序列生成下一个
ALTER TABLE ONLY "PUBLIC"."sys_deploy_form" ALTER COLUMN "id" SET DEFAULT NEXTVAL('PUBLIC.sys_deploy_form_seq'::REGCLASS);
给用户赋予权限
ALTER TABLE "PUBLIC"."sys_deploy_form_seq" OWNER TO "SYSTEM";