Search Postgresql Archives

Re: Specifying columns returned by a function, when the function is in a SELECT column list?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 19, 2024 at 8:48 AM Ron Johnson <ronljohnsonjr@xxxxxxxxx> 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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux