mirror of
https://github.com/postgres/postgres.git
synced 2025-12-06 00:02:13 +03:00
Adjust the recent patch for reporting of deadlocked queries so that we report
query texts only to the server log. This eliminates the issue of possible leaking of security-sensitive data in other sessions' queries. Since the log is presumed secure, we can now log the queries of all sessions involved in the deadlock, whether or not they belong to the same user as the one reporting the failure.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.170 2008/03/21 21:08:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.171 2008/03/24 18:22:36 tgl Exp $
|
||||
* ----------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@@ -2056,7 +2056,7 @@ pgstat_read_current_status(void)
|
||||
* ----------
|
||||
*/
|
||||
const char *
|
||||
pgstat_get_backend_current_activity(int pid)
|
||||
pgstat_get_backend_current_activity(int pid, bool checkUser)
|
||||
{
|
||||
PgBackendStatus *beentry;
|
||||
int i;
|
||||
@@ -2094,7 +2094,7 @@ pgstat_get_backend_current_activity(int pid)
|
||||
if (found)
|
||||
{
|
||||
/* Now it is safe to use the non-volatile pointer */
|
||||
if (!superuser() && beentry->st_userid != GetUserId())
|
||||
if (checkUser && !superuser() && beentry->st_userid != GetUserId())
|
||||
return "<insufficient privilege>";
|
||||
else if (*(beentry->st_activity) == '\0')
|
||||
return "<command string not enabled>";
|
||||
|
||||
Reference in New Issue
Block a user