How to pass scheme name to PgSQL function?
Answer:

  DROP FUNCTION IF EXISTS public.test;
    CREATE FUNCTION public.test(scheme_name character varying)
    RETURNS TABLE(base_name text, scheme_name text)
        LANGUAGE plpgsql
        AS $$
    BEGIN
    RETURN QUERY EXECUTE
        'SELECT ' ||scheme_name||'.bases.base_name, ' ||scheme_name||'.servers.scheme_name FROM ' ||param||'.bases,'||param||'.servers'
        ' WHERE ' ||scheme_name||'.stations.id = ' ||scheme_name||'.servers.id';
    $$;