From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Caleb(dot)Welton <caleb(dot)welton(at)emc(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, itagaki(dot)takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, david <david(at)fetter(dot)org> |
Subject: | Re: UNNEST ... WITH ORDINALITY (AND POSSIBLY OTHER STUFF) |
Date: | 2010-11-19 19:31:05 |
Message-ID: | 1290194728-sup-123@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 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 <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2010-11-19 19:33:45 | Re: Latches with weak memory ordering (Re: max_wal_senders must die) |
Previous Message | Pavel Stehule | 2010-11-19 19:25:44 | how correctly detoast a Datum value? |