I keep getting this ERROR: the reference to the "person" column is ambiguous.
I need to return a TABLE (integer). It works great when I use the SETOF integer, but in this case it does not work. My other recurse () function perfectly returns a set of integers.
CREATE OR REPLACE FUNCTION try(_group text) RETURNS TABLE (person integer) AS $$
DECLARE
_init_id integer;
_record integer;
BEGIN
SELECT id INTO _init_id FROM egroups WHERE name = _group;
FOR _record in SELECT person FROM egroupdata WHERE egroup IN (SELECT recurse(_init_id))
LOOP
RETURN NEXT;
END LOOP;
END;
$$ language plpgsql stable;
source
share