plpgsql function not working

From: "Ruff, Jeffry C(dot) SR(dot)" <jeffry(dot)ruff(at)tycoelectronics(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql function not working
Date: 2005-04-25 19:40:29
Message-ID: 6BE8DF1375AAEA49A52D14266506F55A010BB55F@usz21mx00.tycoelectronics.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found this function on line [Thanks to Jeff Eckermann and Juerg Rietmann] that takes the results of a query and creates a comma delimited string. However when I run it I get no values. Any help would be appreciated. I apologize if this is the wrong forum.
Jeff Ruff
Tycoelectronics Power Systems

Function:
DROP FUNCTION userinfo.group_list(text);
CREATE FUNCTION userinfo.group_list(text) RETURNS text AS'
DECLARE
rec RECORD;
string text := NULL;
BEGIN
FOR rec IN SELECT * FROM userinfo.userdb_groups WHERE username = $1 LOOP
string := string || rec.groupname || \',\';
END LOOP;
string := substr(string, 1, length(string)-1);
RETURN string;
END;
'LANGUAGE 'plpgsql';

Acts on database listing name userdb_groups

key username groupname
==== ======= ========
1023 jruff srcadm
1024 jruff libadm
1025 jruff mpdev
1026 jruff systems
1027 jruff ug
1027 jruff cadadm
1028 jruff mppm
1029 jruff corerd
1030 jruff weblive

Jeff Ruff
Tyco Electronics Power Systems, Inc.
CAD Support Group
phone: 972-284-4267
email: jeffry(dot)ruff(at)tycoelectronics(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2005-04-25 19:48:33 Re: column size in libpq
Previous Message Tony Caduto 2005-04-25 18:11:42 Re: Playing with PostgreSQL and Access VBA