Re: ERROR: operator does not exist: integer = integer[]

Поиск
Список
Период
Сортировка
От A Gilmore
Тема Re: ERROR: operator does not exist: integer = integer[]
Дата
Msg-id 437EB146.6020303@shaw.ca
обсуждение исходный текст
Ответ на ERROR: operator does not exist: integer = integer[]  (A Gilmore <agilmore@shaw.ca>)
Список pgsql-novice
A Gilmore wrote:
> CREATE OR REPLACE FUNCTION tmpfunc(int[]) RETURNS int[] AS '
> DECLARE
>     Ids ALIAS FOR $1;
>     AllIds int[];
> BEGIN
>     AllIds := Ids || array(select id2 from t1 where id1 in (Ids) group
> by id2);
>     RETURN AllIds;
> END
> ' LANGUAGE 'plpgsql';
>
> SELECT * FROM tmpfunc(array[1,2]);
> ERROR:  operator does not exist: integer = integer[]
>

Got it, the array() was done wrong.  Works as :

AllIds := Ids || array(select id2 from t1 where id1 = ANY (Ids) group by
id2);

- A Gilmore

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

Предыдущее
От: A Gilmore
Дата:
Сообщение: ERROR: operator does not exist: integer = integer[]
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Loop through records