pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: shihao zhong <zhong950419@gmail.com>
Cc: marcos.castedo@anachronics.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19816: PL/Python SD dictionary is split by input collation in 19rc1
Date: Mon, 09 Nov 2026 14:21:48 -0500
Message-ID: <2491842.1794252108@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGRkXqSAdTj_pk3wZbjbZQU_HjB9Hj0Ybwc3J5RrFM1j7RvckA@mail.gmail.com>
References: <19816-921b5cbc3ee63146@postgresql.org>
	<CAGRkXqSAdTj_pk3wZbjbZQU_HjB9Hj0Ybwc3J5RrFM1j7RvckA@mail.gmail.com>

shihao zhong <zhong950419@gmail.com> writes:
> The attached patch keeps SD in its own hash keyed by function OID and
> trigger relation, as 18 did. So every cache entry of a function shares
> it.

I'm kind of unconvinced about both this bug report and this patch.
It seems fundamentally schizophrenic, with no real design theory
beyond "let's be bug-compatible with the old behavior".  If the
idea of SD is to be shared across all instances of the same function,
why is it OK to have a different SD per trigger relation?

The thing that is primarily worrying me here is what shall we do when
plpython starts supporting polymorphic arguments/results?  (Maybe
that's not ever gonna happen, but I think it's just something nobody's
gotten around to.)  We will want a separate function cache entry for
each argument type combination seen in a session, for the same reason
as other PLs: so we can cache type-appropriate conversion functions.
With the code as it stands today, that would result in a different SD
for each argument type combination.  Maybe that's sane, maybe it is
not.  You could argue that f(anyelement) is just an abstract prototype
for a bunch of different concrete functions f(int), f(int8), etc, and
that users would rather those concrete functions not share SDs.  If
what was being kept in SD was at all argument-type-specific then you
likely would want that behavior.

So basically, I see four potential contributors to a cache key for SD:

1. Function/procedure OID
2. Trigger relation OID, if a trigger
3. Actual argument types
4. Collation

It's not very apparent to me why #2 is a legitimate cache key but
#3 and #4 are not.  Maybe that's the right thing, but is there any
defensible reasoning behind it?

			regards, tom lane






view thread (11+ messages)  latest in thread

Message-ID: <2491842.1794252108@sss.pgh.pa.us>
Permalink:  ../2491842.1794252108@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2491842.1794252108@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, zhong950419@gmail.com, marcos.castedo@anachronics.com
  Subject: Re: BUG #19816: PL/Python SD dictionary is split by input collation in 19rc1
  In-Reply-To: <2491842.1794252108@sss.pgh.pa.us>
  References: <19816-921b5cbc3ee63146@postgresql.org> <CAGRkXqSAdTj_pk3wZbjbZQU_HjB9Hj0Ybwc3J5RrFM1j7RvckA@mail.gmail.com> <2491842.1794252108@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