In order to add items to an array:
ie. array[2] := variable;

Use the below works, but is quite slow (due to the execute):

DECLARE
  data ALIAS FOR $1;
  arr text[];

  -- Required due to bad arrays
  query text;
  rec RECORD;
BEGIN

  -- WHAT WE WANT:
  -- arr[1] := data;


  -- HERE''S HOW WE DO IT:
  query := ''SELECT cast(''''{"'' || data || ''"}'''' as _text) as
arr'';

  -- Expecting a single loop only.
  FOR rec IN EXECUTE query LOOP
    arr := rec.arr;
  END LOOP

END;

--
Rod Taylor

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.



Sun, 3 Mar 2002 21:49:05 -0500
"Rod Taylor" <rbt@zort.ca>
plpgsql nitpicking -- possible TODO item?