On 07/25/2013 02:01 AM, Andres Freund wrote:
> And much of that can trivially/centrally be rewritten to LATERAL, not
> to speak of the cross-version compatibility problem.
An interesting example of that can be found here:
http://stackoverflow.com/q/12414750/398670
where someone's looking for a way to "zip" two arrays pairwise into an
array of arrays.
As far as I can tell LATERAL won't help with this; you'd need unnest
WITH ORDINALITY then a join on the ordinal, or you'd need full support
for SQL UNNEST with multiple array arguments.
Unless LATERAL provides a way to do lock-step iteration through a pair
(or more) of functions I don't think we can get rid of SRFs-in-FROM just
yet.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services