From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Bruce Momjian" <bruce(at)momjian(dot)us> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Array behavior oddities |
Date: | 2008-01-15 16:14:30 |
Message-ID: | 874pdfhxqx.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Bruce Momjian" <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> Why do you find that surprising? It's either a slice or it isn't,
>> there's no halfway point. Are you proposing to throw an error if only
>> some of the subscripts have colons? What would be the point?
>
> What is confusing is if I see [1:3][2], I assume that is [1:3][2:2], not
> [1:3][1:2]. By what logic does [2] mean from 1 to 2?
Here's something else which confused me just now. Why does the second query
return NULL instead of an array slice?
postgres=# select (array['{foo}'::text[],'{bar}'])[1][1];
array
-------
foo
(1 row)
postgres=# select (array['{foo}'::text[],'{bar}'])[1];
array
-------
(1 row)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's PostGIS support!
From | Date | Subject | |
---|---|---|---|
Next Message | Yoshiyuki Asaba | 2008-01-15 16:21:40 | ts_headline() dumps core |
Previous Message | Gregory Stark | 2008-01-15 16:12:25 | Re: Declarative partitioning grammar |