Re: why does plperl cache functions using just a bool for is_trigger
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Alex Hunsaker <badalex@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Jan Urbański <wulczer@wulczer.org>, Postgres - Hackers <pgsql-hackers@postgresql.org>
Date: 2010-10-31T21:17:56Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove unnecessary use of trigger flag to hash plperl functions
- 2d01ec0708d5 9.1.0 cited
On 10/31/2010 04:40 PM, Alex Hunsaker wrote: > On Sun, Oct 31, 2010 at 12:00, Andrew Dunstan<andrew@dunslane.net> wrote: >> On 10/31/2010 11:44 AM, Tom Lane wrote: >>> Good catch, patch reverted (and regression test added). >> Well, I guess that answers the question of why we needed it, which nobody >> could answer before. I'm not sure I exactly understand what's going on here, >> though - I guess I need to look at it closer. At least I think we need a >> code comment on why the trigger flag is needed as part of the hash key. > The stack trace is: > #0 0x0000000000000000 in ?? () > #1 0x00000000006c18e9 in InputFunctionCall (flinfo=0x2a039a0, > str=0x0, typioparam=0, typmod=-1) > #2 0x00007ff6d2bdf950 in plperl_func_handler (fcinfo=0x7fff4743bec0) > at plperl.c:1729 > > which happens because prodesc->result_in_func.fn_addr (flinfo) is > NULL. That happens because when we are a trigger we don't setup > input/output conversion. And with the change we get the same > proc_desc for triggers and non triggers, so if the trigger function > gets called first, any call to the direct function will use the same > proc_desc with the wrong input/out conversion. How does that happen given that the function Oid is part of the hash key? > There is a check so that trigger functions can not be called as plain > functions, but it only gets called when we do not have an entry in > plperl_proc_hash. I think just moving that up, something the like the > attached should be enough. This looks like the right fix, though. cheers andrew