Repair oversights in the mechanism used to store compiled plpgsql functions.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 08c17d6e56552a0f97f9f7ad68f2435f73f48f85
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-01-30T22:05:20Z
Releases: 8.2.2
Repair oversights in the mechanism used to store compiled plpgsql functions.
The original coding failed (tried to access deallocated memory) if there were
two active call sites (fn_extra pointers) for the same function and the
function definition was updated.  Also, if an update of a recursive function
was detected upon nested entry to the function, the existing compiled version
was summarily deallocated, resulting in crash upon return to the outer
instance.  Problem observed while studying a bug report from Sergiy
Vyshnevetskiy.

Bug does not exist before 8.1 since older versions just leaked the memory of
obsoleted compiled functions, rather than trying to reclaim it.

Files

PathChange+/−
src/pl/plpgsql/src/pl_comp.c modified +88 −21
src/pl/plpgsql/src/pl_handler.c modified +24 −9
src/pl/plpgsql/src/plpgsql.h modified +3 −1