In Postgres 8.4 (and I believe 8.3 as well), the regexp_split_to_table is available. This would work, however, I needed something for 8.1 as well.
This seems to work ok:
create or replace function split_xmcuser_groups_to_tuples() RETURNS SETOF RECORD AS $$
DECLARE
r a%rowtype;
strLen integer;
curIdx integer;
commaCnt integer;
curCSV varchar;
BEGIN
curIdx := 1;
commaCnt := 1;
FOR r IN SELECT * FROM a
LOOP
strLen := char_length(r.csv);
while curIdx <= strLen LOOP
curIdx := curIdx + 1;
if substr(r.csv, curIdx, 1) = ',' THEN
commaCnt := commaCnt + 1;
END IF;
END LOOP;
curIdx := 1;
while curIdx <= commaCnt LOOP
curCSV := split_part(r.csv, ',', curIdx);
if curCSV != '' THEN
RETURN QUERY select r.a,curCSV;
END IF;
curIdx := curIdx + 1;
END LOOP;
END LOOP;
RETURN;
END
$$ LANGUAGE 'plpgsql';
(and yes, I know about the performance implications and reasons not to do this)