Closed
Description
SQL:
declare
v_parent text;
v_patition text;
v_rang_min text;
begin
--RAISE WARNING 'args: %', args;
v_parent := args->>'parent';
v_patition := args->>'partition';
v_rang_min := args->>'range_min';
--RAISE WARNING 'args: %, %, %', v_parent, v_patition,v_rang_min;
--execute 'alter table '||v_patition||' rename CONSTRAINT pathman_'||v_patition||'_1_check to pathman_'||v_parent||'_'||to_char(v_rang_min::date,'yyyymm')||'_1_check';
execute 'alter table '||v_patition||' rename to '||v_parent||'_'||to_char(v_rang_min::date,'yyyymm');
end;
$$ language plpgsql;
create table t4(a date not null);
select set_init_callback('t4','part_onemon_callback');
select create_partitions_from_range('t4','a',date'20161001',date'20170101',interval'1 month');
select * from pathman_partition_list where parent = 't4'::regclass;
insert into t4 values ('20161201');
select * from only t4;
insert into t4 values ('20171111');
Error log:
2016-11-15 17:23:29.336 CST,,,10756,,582ad411.2a04,2,,2016-11-15 17:23:29 CST,4/562,24655465,LOG,00000,"create_partitions_internal(): date out of range: ""8966732-11-09"" [10756]",,,,,,,,,""
2016-11-15 17:23:29.365 CST,"postgres","postgres",7939,"[local]",582ad3b1.1f03,8,"INSERT",2016-11-15 17:21:53 CST,3/2426,24655464,ERROR,XX000,"Attempt to spawn new partitions of relation ""t4"" failed",,"See server log for more details.",,,,"insert into t4 values ('20171111');",,,"psql"