Excerpts from Caleb.Welton's message of vie nov 19 15:48:06 -0300 2010:
> Note the standard also supports unnesting multiple arrays concurrently, the 
> rule for handling arrays with different lengths is to use null padding of the 
> shorter array.
> 
> SELECT * FROM
>    UNNEST( ARRAY[5,2,3,4],
>            ARRAY['hello', 'world'] )
>    WITH ORDINALITY AS t(a,b,i);
> 
> a     b     i
> ---   ---------- ------
> 5  'hello'  1
> 2  'world'  2
> 3           3
> 4           4
> (4 rows)

Hmm, this is pretty interesting and useful --- I had to deal with some
XPath code not long ago and I had to turn to plpgsql; I think it could
have been done with multi-array unnest.

-- 
Álvaro Herrera <alvhe...@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to