Re: trigger functions broken?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: trigger functions broken?
Date: 2008-10-08 22:56:24
Message-ID: 901.1223506584@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-10-08 23:03:36 Re: [WIP] plpgsql is not translate-aware
Previous Message Kevin Grittner 2008-10-08 22:53:25 Re: 8.4devel out of memory