Fix overly tense optimization of PLpgSQL_func_hashkey: we must represent

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

Commit: 603ce026546552747ef8ee165a49de4d10380527
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2008-10-09T16:35:33Z
Releases: 8.0.19
Fix overly tense optimization of PLpgSQL_func_hashkey: we must represent
the isTrigger state explicitly, not rely on nonzero-ness of trigrelOid
to indicate trigger-hood, because trigrelOid will be left zero when compiling
for validation.  The (useless) function hash entry built by the validator
was able to match an ordinary non-trigger call later in the same session,
thereby bypassing the check that is supposed to prevent such a call.
Per report from Alvaro.

It might be worth suppressing the useless hash entry altogether, but
that's a bigger change than I want to consider back-patching.

Back-patch to 8.0.  7.4 doesn't have the problem because it doesn't
have validation mode.

Files

PathChange+/−
src/pl/plpgsql/src/pl_comp.c modified +5 −2
src/pl/plpgsql/src/plpgsql.h modified +5 −1