Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xQUzf-00000000AKn-3JkB for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Nov 2026 19:25:27 +0000 Received: from localhost ([127.0.0.1]:56570 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xQUze-00000002Msv-1msm for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Nov 2026 19:25:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:48438) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xQUwD-00000002KYk-49Ue for pgsql-bugs@lists.postgresql.org; Mon, 09 Nov 2026 19:21:54 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xQUwC-000000005uH-0Nbk for pgsql-bugs@lists.postgresql.org; Mon, 09 Nov 2026 19:21:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 6A9JLmvn2491843; Mon, 9 Nov 2026 14:21:48 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 sss.pgh.pa.us 6A9JLmvn2491843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sss.pgh.pa.us; s=default; t=1794252109; bh=pzyhhKM1F3KdsNJOcAEIbpfYYOMwlwg3JcmZSSs5Jyc=; h=From:To:cc:Subject:In-reply-to:References:Date:From; b=ckO8xjMIdJHcP0hvec1Rglf2DXNr6Nyu5gwp45vTrnxJGeY7Ozt+Deu8V1Dq0mkSM 1hzr1jQ4hZTQA8zQdzZ+JtyQ+UoV8d+yFFO0wsdsivnU/1JT9AN1At2vtMc2FDcLTj kkKGQ6Npa4vZkAvBscM43mTDZuZKYeQVJ52HXVqQ= From: Tom Lane To: shihao zhong cc: marcos.castedo@anachronics.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19816: PL/Python SD dictionary is split by input collation in 19rc1 In-reply-to: References: <19816-921b5cbc3ee63146@postgresql.org> Comments: In-reply-to shihao zhong message dated "Mon, 09 Nov 2026 00:21:21 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2491841.1794252108.1@sss.pgh.pa.us> Date: Mon, 09 Nov 2026 14:21:48 -0500 Message-ID: <2491842.1794252108@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk shihao zhong 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