"aiwaniuk" <aiwaniuk@instytut.com.pl> writes:
> i postgres version 8.2, 8.3 and probobly 8.1 there is problem with running
> VOLATILE plpgsql function with begin - exception checking that performs
> other VOLATILE plpgsql function. if either, first or second performing
> removed, problem doesn't shows. here's an example
The reason there's an issue here is that you're invoking the same
function f() both inside and outside the subtransactions caused by
the begin/exception block. The expressions inside f() get re-prepared
each time the subtransaction ID changes. The memory this eats is
reclaimed at subtransaction end. So the memory used by the call inside
the begin/exception block is cleaned up immediately, but the memory
used by the other call accumulates in the outer subtransaction's
workspace.
We'll think about how to fix this, but you shouldn't expect that a
fix will appear quickly. A possible workaround is to put another
begin/exception block around the other call of the function.
regards, tom lane