Re: trigger functions broken? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: trigger functions broken?
Date
Msg-id 901.1223506584@sss.pgh.pa.us
Whole thread Raw
In response to trigger functions broken?  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Trigger functions are supposed to be able to be called only as triggers,
> but apparently the check is not working in CVS HEAD:

I traced through this, and what is happening is that the validator's
trial compilation of the function doesn't complain (as indeed it
shouldn't) but then it produces a function cache entry that successfully
matches the non-trigger call later.  Since the error check is made while
compiling, it doesn't happen during that call.  So the proximate cause
is that compute_function_hashkey() is failing to ensure that the hash
keys are distinct in the two cases.

You do get an error when you try to call the function in a session other
than the one that defined it.

I wonder whether we should allow the validator to produce a persistent
cache entry at all.  I guess in simple cases (not trigger, not
polymorphic) the validator's compilation is perfectly fine, but it
seems like trouble waiting to happen.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: 8.4devel out of memory
Next
From: Alvaro Herrera
Date:
Subject: Re: [WIP] plpgsql is not translate-aware