Re: Can't get the field = ANY(array) clause to work...

From: nboutelier(at)hotmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Can't get the field = ANY(array) clause to work...
Date: 2006-02-02 19:04:05
Message-ID: 1138907045.513329.12210@g49g2000cwa.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The problem was fixed by initializing the array before giving it a
value. Not surprising Postges isnt as popular as it should be. I was by
luck that I found this out - the manual says nothing about init arrays.

DECLARE
id_var INTEGER[];
record_var RECORD;
BEGIN
id_var := '{}';
id_var[0] := 1;
id_var[1] := 2;
id_var[2] := 3;
FOR record_var IN
SELECT id FROM myTable WHERE id = ANY(id_var)
LOOP
RETURN NEXT record_var.id;
END LOOP;
RETURN;
END;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nboutelier 2006-02-02 19:06:45 Re: Equivalent of a RECORD[] data type used in a function?
Previous Message Magnus Hagander 2006-02-02 18:29:14 Re: Alternative to knoda, kexi and rekall?