Re: Can't get the field = ANY(array) clause to work... - Mailing list pgsql-general

From nboutelier@hotmail.com
Subject Re: Can't get the field = ANY(array) clause to work...
Date
Msg-id 1138907045.513329.12210@g49g2000cwa.googlegroups.com
Whole thread Raw
In response to Can't get the field = ANY(array) clause to work...  (nboutelier@hotmail.com)
Responses Re: Can't get the field = ANY(array) clause to work...  (Bricklen Anderson <banderson@presinet.com>)
Re: Can't get the field = ANY(array) clause to work...  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List 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;


pgsql-general by date:

Previous
From: "Trans Porter"
Date:
Subject: pgsql on win xp user permissions
Next
From: nboutelier@hotmail.com
Date:
Subject: Re: Equivalent of a RECORD[] data type used in a function?