Re: FmgrInfo allocation patterns (and PL handling as staged programming) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: FmgrInfo allocation patterns (and PL handling as staged programming)
Date
Msg-id 1570495.1744728729@sss.pgh.pa.us
Whole thread Raw
In response to Re: FmgrInfo allocation patterns (and PL handling as staged programming)  (Chapman Flack <jcflack@acm.org>)
Responses transforms [was Re: FmgrInfo allocation patterns (and PL handling as staged programming)]
List pgsql-hackers
Chapman Flack <jcflack@acm.org> writes:
> On 04/06/25 22:37, Tom Lane wrote:
>> 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.

> Pursuing that idea a bit further, was there a compelling original reason
> the column in pg_proc had to be protrftypes and not just protransforms?

The problem from a PL's standpoint is "given this input or output
of type FOO, should I transform it, and if so using what?".  So
the starting point has to be a type not a transform.  The lookups
are implemented by get_transform_tosql and get_transform_fromsql,
and if you look at those you find that the protrftypes data is used
as a filter before attempting a pg_transform lookup.  If the pg_proc
entry contained transform OIDs we'd have to filter after the lookup,
which is pretty inefficient, especially if you expect that the normal
case is that there's not an applicable transform.

So I agree with storing protrftypes.  Maybe we should also have stored
a parallel array of transform OIDs, but it'd be just to make the
dependency more obvious, and maybe it's not worth the storage space.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Benoit Lobréau
Date:
Subject: Re: Doc: Move standalone backup section, mention -X argument
Next
From: Greg Sabino Mullane
Date:
Subject: Re: [Proposal] Add \dAt [AMPTRN [TBLPTRN]] to list tables by Table Access Method in psql