On Tue, Nov 19, 2024 at 8:48 AM Ron Johnson <ronljohnso...@gmail.com> wrote:

> It's trivial to specify columns when a table-returning function is the
> FROM clause, but how does one specify columns when the table-returning
> function is a column in a SELECT clause?
>

You don't/cannot.  And with lateral you shouldn't find the need to hack
around it either.  Non-scalar function calls in the select clause are now
obsolete.

In the select clause the function call returns a single-column of composite
type with the names of the fields in the composite already known.  As the
query scope where you invoke the function you should only use the
composite.  If you need to dive into its fields you'd need a subquery -
ideally one that doesn't risk being optimized away due to a
multiple-evaluation hazard.

David J.

Reply via email to