plpgsql function not working - Mailing list pgsql-general

From Ruff, Jeffry C. SR.
Subject plpgsql function not working
Date
Msg-id 6BE8DF1375AAEA49A52D14266506F55A010BB55F@usz21mx00.tycoelectronics.net
Whole thread Raw
Responses Re: plpgsql function not working  (John DeSoi <desoi@pgedit.com>)
Re: plpgsql function not working  (Michael Fuhr <mike@fuhr.org>)
List 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.ruff@tycoelectronics.com

pgsql-general by date:

Previous
From: Tony Caduto
Date:
Subject: Re: Playing with PostgreSQL and Access VBA
Next
From: John DeSoi
Date:
Subject: Re: column size in libpq