Check for USAGE (instead of MEMBER) privilege in all pg_has_role occurrences

This commit is contained in:
RealGreenDragon
2024-09-09 20:35:37 +02:00
committed by Martín Marqués
parent f69485c0ba
commit 4a28c57bc7

View File

@@ -2024,13 +2024,13 @@ connection_has_pg_monitor_role(PGconn *conn, const char *subrole)
initPQExpBuffer(&query); initPQExpBuffer(&query);
appendPQExpBufferStr(&query, appendPQExpBufferStr(&query,
" SELECT CASE " " SELECT CASE "
" WHEN pg_catalog.pg_has_role('pg_monitor','MEMBER') " " WHEN pg_catalog.pg_has_role('pg_monitor','USAGE') "
" THEN TRUE "); " THEN TRUE ");
if (subrole != NULL) if (subrole != NULL)
{ {
appendPQExpBuffer(&query, appendPQExpBuffer(&query,
" WHEN pg_catalog.pg_has_role('%s','MEMBER') " " WHEN pg_catalog.pg_has_role('%s','USAGE') "
" THEN TRUE ", " THEN TRUE ",
subrole); subrole);
} }