Skip to content

Commit b3bd182

Browse files
committed
Fix missing invalidations for search_path cache.
Reported-by: Noah Misch Discussion: https://postgr.es/m/20240630223047.1f.nmisch@google.com Backpatch-through: 17
1 parent e719248 commit b3bd182

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/backend/catalog/namespace.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static void AccessTempTableNamespace(bool force);
230230
static void InitTempTableNamespace(void);
231231
static void RemoveTempRelations(Oid tempNamespaceId);
232232
static void RemoveTempRelationsCallback(int code, Datum arg);
233-
static void NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue);
233+
static void InvalidationCallback(Datum arg, int cacheid, uint32 hashvalue);
234234
static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
235235
bool include_out_arguments, int pronargs,
236236
int **argnumbers);
@@ -4749,27 +4749,41 @@ InitializeSearchPath(void)
47494749

47504750
/*
47514751
* In normal mode, arrange for a callback on any syscache invalidation
4752-
* of pg_namespace or pg_authid rows. (Changing a role name may affect
4753-
* the meaning of the special string $user.)
4752+
* that will affect the search_path cache.
47544753
*/
4754+
4755+
/* namespace name or ACLs may have changed */
47554756
CacheRegisterSyscacheCallback(NAMESPACEOID,
4756-
NamespaceCallback,
4757+
InvalidationCallback,
47574758
(Datum) 0);
4759+
4760+
/* role name may affect the meaning of "$user" */
47584761
CacheRegisterSyscacheCallback(AUTHOID,
4759-
NamespaceCallback,
4762+
InvalidationCallback,
4763+
(Datum) 0);
4764+
4765+
/* role membership may affect ACLs */
4766+
CacheRegisterSyscacheCallback(AUTHMEMROLEMEM,
4767+
InvalidationCallback,
47604768
(Datum) 0);
4769+
4770+
/* database owner may affect ACLs */
4771+
CacheRegisterSyscacheCallback(DATABASEOID,
4772+
InvalidationCallback,
4773+
(Datum) 0);
4774+
47614775
/* Force search path to be recomputed on next use */
47624776
baseSearchPathValid = false;
47634777
searchPathCacheValid = false;
47644778
}
47654779
}
47664780

47674781
/*
4768-
* NamespaceCallback
4782+
* InvalidationCallback
47694783
* Syscache inval callback function
47704784
*/
47714785
static void
4772-
NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue)
4786+
InvalidationCallback(Datum arg, int cacheid, uint32 hashvalue)
47734787
{
47744788
/*
47754789
* Force search path to be recomputed on next use, also invalidating the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy