Re: Set returning functions in select column list - Mailing list pgsql-general

From Tom Lane
Subject Re: Set returning functions in select column list
Date
Msg-id 26377.1329492647@sss.pgh.pa.us
Whole thread Raw
In response to Re: Set returning functions in select column list  (David Johnston <polobo@yahoo.com>)
List pgsql-general
David Johnston <polobo@yahoo.com> writes:
> On Feb 16, 2012, at 14:19, Jack Christensen <jackc@hylesanderson.edu> wrote:
>> Can someone explain how set returning functions in a select clause work?

> You apparently just did...it CROSS JOINs except in the special case where multiple functions each return the same
numberof records (generally due to them all operating on the same sized input - like unnest(array) - in which case it
synchronizesthe generated rows. 

I believe the number of rows you get is the least common multiple of the
lengths of the SRF results.  This behavior is widely disliked, but we're
unlikely to change it for fear of breaking working apps.  The long-term
plan is to implement LATERAL in FROM and then deprecate using SRFs in
target lists altogether.

            regards, tom lane

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: MySQL search query is not executing in Postgres DB
Next
From: David W Noon
Date:
Subject: Re: Set returning functions in select column list