1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

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
This commit is contained in:
Jeff Davis
2023-08-07 15:13:24 -07:00
parent c27f8621ee
commit fa2e874946
4 changed files with 162 additions and 1 deletions

View File

@@ -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;
}