Skip to content

Commit

Permalink
Make privileges check consistent with the other ones.
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonin Houska committed Jun 13, 2024
1 parent 6e1f4f4 commit 2ade0e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pgstatapprox.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ squeeze_pgstattuple_approx(PG_FUNCTION_ARGS)
HeapTuple ret;
int i = 0;

if (!superuser())
if (!superuser() && !has_rolreplication(GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to use pgstattuple functions"))));
(errmsg("must be superuser or replication role to run this function"))));


if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
Expand Down

0 comments on commit 2ade0e0

Please sign in to comment.