Re: UNNEST ... WITH ORDINALITY (AND POSSIBLY OTHER STUFF) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: UNNEST ... WITH ORDINALITY (AND POSSIBLY OTHER STUFF)
Date
Msg-id 1290194728-sup-123@alvh.no-ip.org
Whole thread Raw
In response to Re: UNNEST ... WITH ORDINALITY (AND POSSIBLY OTHER STUFF)  (<Caleb.Welton@emc.com>)
List pgsql-hackers
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
lengthsis 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 <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: how correctly detoast a Datum value?
Next
From: Andres Freund
Date:
Subject: Re: Latches with weak memory ordering (Re: max_wal_senders must die)