postgresql/src/pl
Tom Lane c0486e9dea Fix plpgsql's handling of "simple" expression evaluation.
In general, expression execution state trees aren't re-entrantly usable,
since functions can store private state information in them.
For efficiency reasons, plpgsql tries to cache and reuse state trees for
"simple" expressions.  It can get away with that most of the time, but it
can fail if the state tree is dirty from a previous failed execution (as
in an example from Alvaro) or is being used recursively (as noted by me).

Fix by tracking whether a state tree is in use, and falling back to the
"non-simple" code path if so.  This results in a pretty considerable speed
hit when the non-simple path is taken, but the available alternatives seem
even more unpleasant because they add overhead in the simple path.  Per
idea from Heikki.

Back-patch to all supported branches.
2010-10-28 13:01:28 -04:00
..
plperl Use a separate interpreter for each calling SQL userid in plperl and pltcl. 2010-09-30 17:21:59 -04:00
plpgsql Fix plpgsql's handling of "simple" expression evaluation. 2010-10-28 13:01:28 -04:00
plpython Some more gitignore cleanups: cover contrib and PL regression test outputs. 2010-09-22 17:22:18 -04:00
tcl Use a separate interpreter for each calling SQL userid in plperl and pltcl. 2010-09-30 17:21:59 -04:00
Makefile Convert the existing regression test scripts for the various optional 2005-05-14 17:55:22 +00:00