Re: Multi-dimensional arrays

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: Multi-dimensional arrays
Дата
Msg-id 5324676B.6050109@iol.ie
обсуждение исходный текст
Ответ на Re: Multi-dimensional arrays  (Thom Brown <thom@linux.com>)
Ответы Re: Multi-dimensional arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 15/03/2014 14:01, Thom Brown wrote:
> On 15 March 2014 12:51, Raymond O'Donnell <rod@iol.ie> wrote:
>> Hello all,
>>
>> Here's an odd one (to me anyway) which I ran into today.... if I have a
>> multidimensional array, why does the following return NULL?
>>
>>     select (array[['abc','def'], ['ghi','jkl']])[1]
>>
>> I would have expected it to return {abc, def}. This, however, returns
>> 'abc' as expected:
>>
>>     select (array[['abc','def'], ['ghi','jkl']])[1][1]
>
> Hmm... I'm not sure.  You can get to it with slices for some reason:
>
> #  select (array[['abc','def'], ['ghi','jkl']])[0:1];
>     array
> -------------
>  {{abc,def}}
> (1 row)

True... though that gives you a 2D array, whereas I was hoping for a 1D
array from (array[...])[1]. I should have mentioned my version, by the way:

    select version();

    PostgreSQL 9.3.0, compiled by Visual C++ build 1600, 64-bit


Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


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

Предыдущее
От: Olivier Chaussavoine
Дата:
Сообщение: pg_worker and notify
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Multi-dimensional arrays