Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf88a638

Browse files
committed
Only show pg_stat_replication details to superusers
1 parentfe12263 commitf88a638

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
299299
<entry>One row per WAL sender process, showing process <acronym>ID</>,
300300
user OID, user name, application name, client's address and port number,
301301
time at which the server process began execution, current WAL sender
302-
state and transaction log location.
302+
state and transaction log location. The columns detailing what exactly
303+
the connection is doing are only visible if the user examining the view
304+
is a superuser.
303305
</entry>
304306
</row>
305307

‎src/backend/replication/walsender.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,20 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
11411141

11421142
memset(nulls,0,sizeof(nulls));
11431143
values[0]=Int32GetDatum(walsnd->pid);
1144-
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
1145-
values[2]=CStringGetTextDatum(sent_location);
1144+
if (!superuser())
1145+
{
1146+
/*
1147+
* Only superusers can see details. Other users only get
1148+
* the pid value to know it's a walsender, but no details.
1149+
*/
1150+
nulls[1]= true;
1151+
nulls[2]= true;
1152+
}
1153+
else
1154+
{
1155+
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
1156+
values[2]=CStringGetTextDatum(sent_location);
1157+
}
11461158

11471159
tuplestore_putvalues(tupstore,tupdesc,values,nulls);
11481160
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp