Pavel Stehule <pavel.stehule@gmail.com> writes:
> po 5. 12. 2022 v 5:28 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
>> I tend to agree with David that LATERAL offers a good-enough
>> solution in most cases ... but it is annoying that we accept
>> this syntax and then pessimize it.
> I agree, so there is a perfect solution like don't use .*, but on second
> hand any supported syntax should be optimized well or we should raise some
> warning about negative performance impact.
Yeah. I wonder if we could get the parser to automatically transform
SELECT (foo(t.x)).* FROM tab t
into
SELECT f.* FROM tab t, LATERAL foo(t.x) f
There are probably cases where this doesn't work or changes the
semantics subtly, but I suspect it could be made to work in
most cases of practical interest.
regards, tom lane