From bd096c4add9b2c04e39f80015d3c48900c44573a Mon Sep 17 00:00:00 2001
From: Nitin Jadhav <nitinjadhav@microsoft.com>
Date: Wed, 18 Jan 2023 07:44:41 +0000
Subject: [PATCH] Improve GetConfigOptionValues function.

GetConfigOptionValues function extracts the config parameters for the given
variable irrespective of whether it results in noshow or not. But the parent
function show_all_settings ignores the values parameter if it results in
noshow. Its unnecessary to fetch all the values during noshow. Hence added
return statement.
---
 src/backend/utils/misc/guc_funcs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/backend/utils/misc/guc_funcs.c b/src/backend/utils/misc/guc_funcs.c
index d59706231b..c6ac31dd59 100644
--- a/src/backend/utils/misc/guc_funcs.c
+++ b/src/backend/utils/misc/guc_funcs.c
@@ -595,7 +595,10 @@ GetConfigOptionValues(struct config_generic *conf, const char **values,
 		if ((conf->flags & GUC_NO_SHOW_ALL) ||
 			((conf->flags & GUC_SUPERUSER_ONLY) &&
 			 !has_privs_of_role(GetUserId(), ROLE_PG_READ_ALL_SETTINGS)))
+		{
 			*noshow = true;
+			return;
+		}
 		else
 			*noshow = false;
 	}
-- 
2.25.1

