Robert Haas <robertmh...@gmail.com> writes: > On Mon, May 23, 2016 at 4:15 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> 2. Rewrite into LATERAL ROWS FROM (srf1(), srf2(), ...). This would >> have the same behavior as before if the SRFs all return the same number >> of rows, and otherwise would behave differently.
> I thought the idea was to rewrite it as LATERAL ROWS FROM (srf1()), > LATERAL ROWS FROM (srf2()), ... No, because then you get the cross-product of multiple SRFs, not the run-in-lockstep behavior. > The rewrite you propose here seems to NULL-pad rows after the first > SRF is exhausted: Yes. That's why I said it's not compatible if the SRFs don't all return the same number of rows. It seems like a reasonable definition to me though, certainly much more reasonable than the current run-until-LCM behavior. > The latter is how I'd expect SRF-in-targetlist to work. That's not even close to how it works now. It would break *every* existing application that has multiple SRFs in the tlist, not just the ones whose SRFs return different numbers of rows. And I'm not convinced that it's a more useful behavior. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers