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

From: A Gilmore <agilmore(at)shaw(dot)ca>
To: A Gilmore <agilmore(at)shaw(dot)ca>
Cc: Postgresql Mailing list <pgsql-novice(at)postgresql(dot)org>
Subject: Re: ERROR: operator does not exist: integer = integer[]
Date: 2005-11-19 04:59:50
Message-ID: 437EB146.6020303@shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message A. Kretschmer 2005-11-19 07:40:57 Re: Loop through records
Previous Message A Gilmore 2005-11-19 03:52:35 ERROR: operator does not exist: integer = integer[]