function returning array

From: "Dennis" <pg-user(at)calico-consulting(dot)com>
To: "postgres SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: function returning array
Date: 2004-04-13 22:41:52
Message-ID: courier.407C6CB0.00005135@wolverine.lercnetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I am trying to return an array from a function and don't seem to be having
luck. The function seems to work fine, but if I do assignment to an array
variable, I get null in the array elements

DECLARE
results varchar[];
tmpv varchar;
BEGIN
-- now call func that returns varchar[]
results := parseString(''abc,def,ghi'','','');
tmpv := results[1];
RAISE NOTICE '' tmpv = % '',tmpv; -- tmpv will be null.

END;

I found reference to this sort of thing not working, but the reference was
from several years ago, so I'm not sure if that is still the case or if I am
doing something wrong.

Do I need to go with returning a set instead?

Dennis S
pg-user(at)calico-consulting(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-04-14 03:30:47 Re: function returning array
Previous Message Tom Lane 2004-04-13 18:35:24 Re: trigger/for key help