Re: Review: UNNEST (and other functions) WITH ORDINALITY - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Review: UNNEST (and other functions) WITH ORDINALITY
Date
Msg-id 51F6203D.4080507@2ndquadrant.com
Whole thread Raw
In response to Re: Review: UNNEST (and other functions) WITH ORDINALITY  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Review: UNNEST (and other functions) WITH ORDINALITY
Re: Review: UNNEST (and other functions) WITH ORDINALITY
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: KONDO Mitsumasa
Date:
Subject: Re: inconsistent state after crash recovery
Next
From: Albe Laurenz
Date:
Subject: Re: potential bug in error message in with clause