Re: Array behavior oddities

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Array behavior oddities
Дата
Msg-id 874pdfhxqx.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: Array behavior oddities  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Array behavior oddities  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
"Bruce Momjian" <bruce@momjian.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!


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Declarative partitioning grammar
Следующее
От: Yoshiyuki Asaba
Дата:
Сообщение: ts_headline() dumps core