Here's the reproducer for the retained flush contexts. Run it in a fresh
superuser session on master ceae3099.

begin;
create temp table p (k int primary key);
create temp table c (k int references p);
insert into p values (1);
do $$
begin
for i in 1..1000 loop begin
insert into c
select case when g = 64 then 2 else 1 end
from generate_series(1, 64) g;
raise exception 'insert unexpectedly succeeded';
exception when foreign_key_violation then null;
end; end loop;
end
$$;
select count(*) as contexts, coalesce(sum(total_bytes), 0) as bytes
from pg_backend_memory_contexts
where name = 'RI fast path flush temporary context';
rollback;

Before rollback, I get 1000 contexts / 16384000 bytes without the patch,
and 0 / 0 with it.

Thanks,
Nik


Reply via email to