Alvaro Herrera <[EMAIL PROTECTED]> 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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to