创建分区表: PostgreSQL分区表_pg分区表-CSDN博客
创建list分区的函数
create or replace function create_list_fq(tb_name char, row_name char)
returns int
AS $$
declare
s char;
begin
raise notice 'CREATE TABLE if not exists %_% PARTITION OF % FOR VALUES IN (''%'');', tb_name, row_name, tb_name, row_name;
execute format('CREATE TABLE if not exists %s_%s PARTITION OF %s FOR VALUES IN (''%s'');', tb_name, row_name, tb_name, row_name);
raise notice '%, %', tb_name, row_name;
return 123;
end;
$$
language plpgsql