Re: Reason why set-value functions not allowed in GREATEST(), etc? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reason why set-value functions not allowed in GREATEST(), etc?
Date
Msg-id 701.1266870294@sss.pgh.pa.us
Whole thread Raw
In response to Reason why set-value functions not allowed in GREATEST(), etc?  (Hitoshi Harada <umi.tanuki@gmail.com>)
List pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.com> writes:
> I just wonder why generate_series() is not allowed in GREATEST syntax.
> Looking through execQual.c,  almost all syntactic evaluations like
> COALESCE, ARRAY[], ROW() doesn't allow set-value functions. Could
> someone tell the underlying reason?

Laziness, or lack of return for the effort, or lack of desire to extend
a semantically dubious behavior even further, as you prefer.

You could support at most one set-returning input (at least without an
order of magnitude increase in complexity and creating even more room
for semantic debate), and keeping track of which one is the set would be
a PITA.  Essentially you'd need to add something of about the complexity
of ExecTargetList() to each one of those special purpose functions.

The other reason is that a lot of us think that SRFs in the targetlist
are not a feature we want to encourage anyway.  The semantics are either
dubious or outright broken depending on who you ask.  And from a
performance standpoint, adding any more complexity to execQual nodes is
not a sane thing to be doing.  What we ought to do is implement LATERAL
and tell people to move in that direction.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: scheduler in core
Next
From: Tom Lane
Date:
Subject: Re: What does this configure warning mean?