summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2023-08-07 15:13:24 -0700
committerJeff Davis <jdavis@postgresql.org>2023-08-09 13:09:25 -0700
commitfa2e874946c5b9f23394358c131e987df7cc8ffb (patch)
tree418135ed5b9a83ec551d0772b02c5d5f9e791f1c /src/backend
parentc27f8621eedf744a7bc80e37dd2d3f0f559edf1b (diff)
Recalculate search_path after ALTER ROLE.
Renaming a role can affect the meaning of the special string $user, so must cause search_path to be recalculated. Discussion: https://postgr.es/m/186761d32c0255debbdf50b6310b581b9c973e6c.camel@j-davis.com Reviewed-by: Nathan Bossart, Michael Paquier Backpatch-through: 11
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/namespace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 1f76b5d7f7b..0c679fbf944 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -4175,11 +4175,15 @@ InitializeSearchPath(void)
{
/*
* In normal mode, arrange for a callback on any syscache invalidation
- * of pg_namespace rows.
+ * of pg_namespace or pg_authid rows. (Changing a role name may affect
+ * the meaning of the special string $user.)
*/
CacheRegisterSyscacheCallback(NAMESPACEOID,
NamespaceCallback,
(Datum) 0);
+ CacheRegisterSyscacheCallback(AUTHOID,
+ NamespaceCallback,
+ (Datum) 0);
/* Force search path to be recomputed on next use */
baseSearchPathValid = false;
}