On 2018-Jun-08, Alvaro Herrera wrote:

> BTW a further bug here seems to be that "select * from pg_settings()"
> does not show the source file/line for members of the role, which seems
> to be documented to occur.

And I think this fixes it.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From c71a14bdac838efc09d01b60383fa6e631606c57 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvhe...@alvh.no-ip.org>
Date: Fri, 8 Jun 2018 15:12:58 -0400
Subject: [PATCH] fix sourcefile/line display for pg_read_all_settings role

---
 src/backend/utils/misc/guc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 274034d88b..e84d56dae6 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -8595,7 +8595,8 @@ GetConfigOptionByNum(int varnum, const char **values, 
bool *noshow)
         * security reasons, we don't show source file/line number for
         * non-superusers.
         */
-       if (conf->source == PGC_S_FILE && superuser())
+       if (conf->source == PGC_S_FILE &&
+               is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_SETTINGS))
        {
                values[14] = conf->sourcefile;
                snprintf(buffer, sizeof(buffer), "%d", conf->sourceline);
-- 
2.11.0

Reply via email to