Re: FmgrInfo allocation patterns (and PL handling as staged programming)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chapman Flack <jcflack@acm.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter@eisentraut.org>
Date: 2025-04-07T02:37:41Z
Lists: pgsql-hackers
Attachments
- v1-fix-bogus-transform-dependencies.patch (text/x-diff) patch v1
Chapman Flack <jcflack@acm.org> writes: > On 04/06/25 20:01, Tom Lane wrote: >> Looking more closely at ProcedureCreate(), it makes a dependency >> if a transform *exists* for the argument or result type, whether >> a TRANSFORM clause is present or not. Surely this is completely >> bogus? We should be depending on the OIDs mentioned in protrftypes, > I think that's it. I tested by creating a function like > create function foo() returns text transform for type circle > that is, with the transform type not appearing as an argument or > return type. > As far as I know, that's still a cromulent usage, as I could be saying > I want the function to apply that transform to circles it uses or retrieves > in queries it makes. Oh, interesting interpretation. The in-core PLs only consider the transform list in relation to parameters and results, but I suppose that's just because they have no use for internal conversions ... and even then, you could argue that that's wrong and they should apply the specified conversions when invoking, say, SQL queries via SPI. Something to think about another day. Here's a draft patch to fix the bogus dependencies. As given this'd only be okay for HEAD, since I doubt we can get away with changing ProcedureCreate()'s signature in stable branches. Given the lack of prior complaints, I'm content to fix this only in HEAD --- but maybe somebody will think differently? In the back branches we could make ProcedureCreate() deconstruct the OID array it's given and then repeat the transform lookups, but ugh. I guess a "ProcedureCreateExt" alternate entry point would do the trick too. BTW, I feel a little uncomfortable with the idea that we're adding dependencies on objects that are explicitly mentioned nowhere in the pg_proc entry. I suppose it's okay, and the preceding code did that too, but still. regards, tom lane
Commits
-
Fix erroneous construction of functions' dependencies on transforms.
- b73e6d71a89f 18.0 landed
-
Change SQL-language functions to use the plan cache.
- 0dca5d68d7be 18.0 cited