CREATE or replace FUNCTION portal.test_ret(a TEXT, b TEXT) 
  RETURNS  TABLE (f1 int, f2 varchar(20)) AS $$
DECLARE 

BEGIN

  RETURN QUERY
  select personid, firstname from dbo.person AS p limit 2;
  

END;$$ LANGUAGE plpgsql