Get few ip postgresql slave from pg_stat_replication using non-superuser
You need a view not just function, e.g.

CREATE OR replace FUNCTION public.pg_stat_repl() returns setof 
  pg_catalog.pg_stat_replication 
AS 
  $$begin 
    RETURN query 
      ( 
       SELECT * 
       FROM pg_catalog.pg_stat_replication); 
  end$$ LANGUAGE plpgsql security definer; 

CREATE VIEW public.pg_stat_repl AS SELECT * FROM public.pg_stat_repl(); 

GRANT SELECT ON public.pg_stat_repl TO non-superuser;


Then you can as non-superuser

SELECT * FROM public.pg_stat_repl;