Re: proposal: type info support functions for functions that use "any" type

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: type info support functions for functions that use "any" type
Date: 2019-08-07 06:11:19
Message-ID: CAFj8pRDTo6NqkJb3_DG2ttbYOfaJ0FF96gL3gbt1BVuQMhVL5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

pá 26. 7. 2019 v 22:53 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> I wrote:
> > TBH, I don't like this proposal one bit. As far as I can see, the idea
> > is to let a function's support function redefine the function's declared
> > argument and result types on-the-fly according to no predetermined rules,
> > and that seems to me like it's a recipe for disaster. How will anyone
> > understand which function(s) are candidates to match a query, or why one
> > particular candidate got selected over others? It's already hard enough
> > to understand the behavior of polymorphic functions in complex cases,
> > and those are much more constrained than this would be.
>
> After thinking about this a bit more, it seems like you could avoid
> a lot of problems if you restricted what the support function call
> does to be potentially replacing the result type of a function
> declared to return ANY with some more-specific type (computed from
> examination of the actual arguments). That would make it act much
> more like a traditional polymorphic function. It'd remove the issues
> about interactions among multiple potentially-matching functions,
> since we'd only call a single support function for an already-identified
> target function.
>
> You'd still need to touch everyplace that knows about polymorphic
> type resolution, since this would essentially be another form of
> polymorphic function. And I'm still very dubious that it's worth
> the trouble. But it would be a lot more controllable than the
> proposal as it stands.
>

I am sending reduced version of previous patch. Now, support function is
used just for replacement of returned type "any" by some other.

The are two patches - shorter with only support function, larger with demo
"decode" function. I don't expect so the "decode" extension should be
pushed to master. It is just demo of usage.

Regards

Pavel

> regards, tom lane
>

Attachment Content-Type Size
parser-support-function.patch text/x-patch 6.7 KB
parser-support-function-with-demo.patch text/x-patch 21.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-08-07 06:17:59 Re: [PATCH] Absolute passwordfile path
Previous Message Danylo Hlynskyi 2019-08-07 06:05:28 Fwd: [PATCH] Absolute passwordfile path