pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Sandro Santilli <strk@keybit.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: cache lookup failed from empty plpythonu function
Date: Thu, 24 Jan 2013 11:40:33 -0500
Message-ID: <19721.1359045633@sss.pgh.pa.us> (raw)
In-Reply-To: <20130124141751.GB21296@awork2.anarazel.de>
References: <20130124140336.GJ3157@gnash>
	<20130124141751.GB21296@awork2.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-01-24 15:03:36 +0100, Sandro Santilli wrote:
> ISTM the caching code for plpythonu trigger functions has been broken
> for some time. The bug seem to be that PLy_procedure_get looks up the
> function in a separate cache for trigger functions (PLy_trigger_cache)
> but still only uses the function oid for lookup.
> So the same function can be looked up for two tables and when the cached
> entry originally refers to the old table that has been dropped we see
> the above error.

> The fix seems tob e to make PLy_trigger_cache have a key of (reloid,
> fn_oid) instead of just fn_oid.

If there's anything in either the cache entry itself or the function's
other persistent state that is dependent on which table it's attached
to, then yeah, obviously.  But another conceivable solution would be to
not store any such information.

In a quick look, it seems like the "PLyTypeInfo result" field might
depend on which table the trigger is attached to, so unless we can
get along without that, we'll need to expand the hash key.

Actually I'm wondering a bit why there are two hash tables at all.
Seems like one table with a hash key of (fnoid, reloid) could be
used, with the convention of reloid = 0 for non-trigger calls.

			regards, tom lane


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



view thread (15+ messages)  latest in thread

Message-ID: <19721.1359045633@sss.pgh.pa.us>
Permalink:  ../19721.1359045633@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19721.1359045633@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@2ndquadrant.com, strk@keybit.net
  Subject: Re: cache lookup failed from empty plpythonu function
  In-Reply-To: <19721.1359045633@sss.pgh.pa.us>
  References: <20130124140336.GJ3157@gnash> <20130124141751.GB21296@awork2.anarazel.de> <19721.1359045633@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox