On 07/29/2013 08:02 PM, Greg Stark wrote:
>> > 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 select target lists] yet
> You don't even need lateral. This works fine:
>
> postgres=# select * from generate_series(1,10) with ordinality as
Exactly - that's why the previous paragraph was:
>> 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.
;-)
I'm interested to see that it might be possible to evaluate multiple
"WITH ORDINALITY" SRFs in FROM together rather than having to perform a
join. That'd make it a much saner replacement for SRFs in the SELECT list.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services