Re: Array Comparison

Поиск
Список
Период
Сортировка
От Ian Harding
Тема Re: Array Comparison
Дата
Msg-id CAMR4UwELU7RnodsmWbTzdG2NMvpKkW3rLns-M6H3fwCMTL0Cag@mail.gmail.com
обсуждение исходный текст
Ответ на Array Comparison  (Ian Harding <harding.ian@gmail.com>)
Ответы Re: Array Comparison  (David G Johnston <david.g.johnston@gmail.com>)
Список pgsql-general

On Fri, Dec 5, 2014 at 4:55 PM, Ian Harding <harding.ian@gmail.com> wrote:
I have a function that returns bigint[] and would like to be able to compare a bigint to the result.
 
freeload=> select fn_descendents('trip'::varchar,61::bigint);
          fn_descendents
-----------------------------------
 {935,815,689,569,446,325,205,191}
(1 row)
freeload=> select 935::bigint in (select fn_descendents('trip'::varchar,61::bigint));
ERROR:  operator does not exist: bigint = bigint[]
LINE 1: select 935::bigint in (select fn_descendents('trip'::varchar...
                           ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
This is probably super obvious but I'm not getting it right now.
 
Hmmm.. This works...
select array[935::bigint] <@ (select fn_descendents('trip'::varchar,61::bigint));
 
Still, why? 

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

Предыдущее
От: Ian Harding
Дата:
Сообщение: Array Comparison
Следующее
От: David G Johnston
Дата:
Сообщение: Re: Array Comparison