array faults?

Поиск
Список
Период
Сортировка
От David Helgason
Тема array faults?
Дата
Msg-id C47AA9CE-42AD-11D8-9789-000A9566DA8A@uti.is
обсуждение исходный текст
Ответы Re: array faults?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Using arrays I came across some strangenesses. Probably this is well
known, but I couldn't find mentions of it.

I am under the impression that this should be an error. Am I wrong?

EXAMPLE 1:
maint=# select ('{{1,2,3},{4,5,6}}'::int[])[1][1:3];
    int4
-----------
  {{1,2,3}}
(1 row)

Shouldn't this have been just {1,2,3} ?

EXAMPLE 2:
maint=# select ('{{1,2,3},{4,5,6}}'::int[])[2][1:3];
    int4
-----------
  {{1,2,3},{4,5,6}}
(1 row)

Shouldn't this have been just {4,5,6} (or maybe {{4,5,6}} accepting the
result of example 1) ?


I am trying to do sth like:
    maint=# select 1 = any ('{{1,2,3},{4,5,6}}'::int[])[2][1:3];
But that is not working for obvious reasons. This makes arrays pretty
broken for me.

Am I missing anything obvious?

Regards,

David Helgason
Over the Edge Entertainments


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Using indices with long unique IDs.
Следующее
От: "Paul Janssen"
Дата:
Сообщение: Re: Optimize query: time of "single * IN(many)" > time of "many *