Re: [HACKERS] plpython trigger code is wrong (Re: Potential bug -- script that drops postgres server)

From: Bradley McLean <brad(at)bradm(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lance Thomas <LThomas(at)DevIS(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] plpython trigger code is wrong (Re: Potential bug -- script that drops postgres server)
Date: 2003-02-15 02:45:39
Message-ID: 20030215024539.GA1541@nia.bradm.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) [030214 19:35]:
> Lance Thomas <LThomas(at)DevIS(dot)com> writes:
> > Below is something that may be of interest -- a short, 7-statement script
> > that seems to drop my postgres server.
>
> It appears that the plpython trigger implementation assumes that any
> given procedure will be used as a trigger for only one relation. The
> reason it crashes is it's trying to use the rowtype info of the relation
> it was first compiled for with the other relation.
>
> Probably the easiest fix is to include the relation OID as part of the
> Python name of a trigger procedure, so that a separate copy is compiled
> for each relation the procedure is used with.

Interesting idea. I had been taking the approach of applying the cache
to just the python compilation, and not the rowtype info. This has a
substantial performance penalty, which I'd been addressing by eliminating
some unneeded parameter processing that doesn't apply in the trigger
case, and considering a separate cache for each rowtype.

> Any plpython users want to step forward and fix this? I have other
> things on my plate ...

I'm looking at the bug right now. Patch in a day or so.

-Brad

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-02-15 06:31:41 Re: Hi,
Previous Message Alan Gutierrez 2003-02-15 01:34:35 Perform Action on Transaction Begin

Browse pgsql-hackers by date

  From Date Subject
Next Message Curt Sampson 2003-02-15 04:44:00 Re: location of the configuration files
Previous Message Tom Lane 2003-02-15 00:39:36 Re: client_encoding directive is ignored in