pgsql return table ERROR: column reference is ambiguous
i keep getting this ERROR:  column reference "person" is ambiguous.

It is required of me to return a TABLE (person integer). It works fine when i use SETOF integer but in this instance it doesn't work. My other funtion recurse() returns a set of integers perfectly well.



   
    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;
pgsql return table ERROR: column reference is ambiguous
===

i keep getting this ERROR:  column reference "person" is ambiguous.

It is required of me to return a TABLE (person integer). It works fine when i use SETOF integer but in this instance it doesn't work. My other funtion recurse() returns a set of integers perfectly well.



   
    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;