Re: transforms - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: transforms
Date
Msg-id 68043280.1010305@acm.org
Whole thread Raw
In response to Re: transforms  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: transforms
List pgsql-hackers
On 04/19/25 19:12, Tom Lane wrote:
> You could argue that
> CREATE FUNCTION foo(anyelement) RETURNS anyelement
> TRANSFORM FOR TYPE int
> AS ...;
> should mean that if the actual argument type is int, then the
> mentioned transform should be applied to the input and result;
> but if it's some other type then just do the normal conversions.
> 
> You could perhaps also argue that that's a bad idea.  I'm not sure.

My position would be that it's not a bad idea. It would be consistent
and unastonishing.

A PL that uses a staging approach has probably precomputed and cached
a good deal of information, including what transforms are requested and
what parameter positions are polymorphic if any, and only needs to check
those when specializing, and funccache can preserve those results too.

Regards,
-Chap



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: transforms
Next
From: Chapman Flack
Date:
Subject: Re: transforms