create user backup;
create user test;

GRANT USAGE ON SCHEMA pg_catalog TO backup;
GRANT USAGE ON SCHEMA pg_catalog TO test;
GRANT EXECUTE ON FUNCTION pg_stop_backup() TO backup;
GRANT EXECUTE ON FUNCTION pg_stop_backup(boolean) TO backup;

GRANT EXECUTE ON FUNCTION pg_switch_xlog() TO backup;
REVOKE EXECUTE ON FUNCTION pg_switch_xlog() FROM backup;
REVOKE ALL ON FUNCTION pg_switch_xlog() FROM test;

GRANT ALL ON FUNCTION pg_stat_get_subscription() TO backup;
REVOKE EXECUTE ON FUNCTION pg_stat_get_subscription() FROM test;

grant all on table pg_subscription to backup;
revoke insert on table pg_subscription from backup;

revoke all on table pg_subscription from test;
grant select on table pg_subscription to test;

grant all on pg_stat_subscription to backup;
revoke all on pg_stat_subscription from test;

grant all on function pg_stat_get_subscription to backup;
revoke all on function pg_stat_get_subscription from test;

grant all (subenabled) on pg_subscription to backup;
