86、postgresql生成序列脚本
创建序列的脚本
CREATE SEQUENCE "public"."v_baseinfo_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 2147483647
START 1
CACHE 1;
查询出来所有的序列,并生成上述脚本
SELECT 'CREATE SEQUENCE ' || sequence_name || ' START WITH ' || start_value || ' INCREMENT BY ' || increment || ' MINVALUE ' || minimum_value || ' MAXVALUE ' || maximum_value || ' CACHE ' || increment || ';'
FROM information_schema.sequences
WHERE sequence_schema = 'public';