diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/cache/catcache.c | 9 | ||||
-rw-r--r-- | src/backend/utils/cache/syscache.c | 4 | ||||
-rw-r--r-- | src/include/utils/catcache.h | 2 | ||||
-rw-r--r-- | src/include/utils/syscache.h | 10 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index 8a0a42ce712..5ddbf6eab10 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -1512,6 +1512,11 @@ GetCatCacheHashValue(CatCache *cache, * Generate a list of all tuples matching a partial key (that is, * a key specifying just the first K of the cache's N key columns). * + * It doesn't make any sense to specify all of the cache's key columns + * here: since the key is unique, there could be at most one match, so + * you ought to use SearchCatCache() instead. Hence this function takes + * one less Datum argument than SearchCatCache() does. + * * The caller must not modify the list object or the pointed-to tuples, * and must call ReleaseCatCacheList() when done with the list. */ @@ -1520,9 +1525,9 @@ SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, - Datum v3, - Datum v4) + Datum v3) { + Datum v4 = 0; /* dummy last-column value */ Datum arguments[CATCACHE_MAXKEYS]; uint32 lHashValue; dlist_iter iter; diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 041cd53a300..2b381782a32 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -1418,14 +1418,14 @@ GetSysCacheHashValue(int cacheId, */ struct catclist * SearchSysCacheList(int cacheId, int nkeys, - Datum key1, Datum key2, Datum key3, Datum key4) + Datum key1, Datum key2, Datum key3) { if (cacheId < 0 || cacheId >= SysCacheSize || !PointerIsValid(SysCache[cacheId])) elog(ERROR, "invalid cache ID: %d", cacheId); return SearchCatCacheList(SysCache[cacheId], nkeys, - key1, key2, key3, key4); + key1, key2, key3); } /* diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h index 39d48761691..7b22f9c7bc5 100644 --- a/src/include/utils/catcache.h +++ b/src/include/utils/catcache.h @@ -214,7 +214,7 @@ extern uint32 GetCatCacheHashValue(CatCache *cache, extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, - Datum v3, Datum v4); + Datum v3); extern void ReleaseCatCacheList(CatCList *list); extern void ResetCatalogCaches(void); diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 55d573c687f..4f333586ee9 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -157,7 +157,7 @@ extern uint32 GetSysCacheHashValue(int cacheId, /* list-search interface. Users of this must import catcache.h too */ struct catclist; extern struct catclist *SearchSysCacheList(int cacheId, int nkeys, - Datum key1, Datum key2, Datum key3, Datum key4); + Datum key1, Datum key2, Datum key3); extern void SysCacheInvalidate(int cacheId, uint32 hashValue); @@ -207,13 +207,11 @@ extern bool RelationSupportsSysCache(Oid relid); GetSysCacheHashValue(cacheId, key1, key2, key3, key4) #define SearchSysCacheList1(cacheId, key1) \ - SearchSysCacheList(cacheId, 1, key1, 0, 0, 0) + SearchSysCacheList(cacheId, 1, key1, 0, 0) #define SearchSysCacheList2(cacheId, key1, key2) \ - SearchSysCacheList(cacheId, 2, key1, key2, 0, 0) + SearchSysCacheList(cacheId, 2, key1, key2, 0) #define SearchSysCacheList3(cacheId, key1, key2, key3) \ - SearchSysCacheList(cacheId, 3, key1, key2, key3, 0) -#define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \ - SearchSysCacheList(cacheId, 4, key1, key2, key3, key4) + SearchSysCacheList(cacheId, 3, key1, key2, key3) #define ReleaseSysCacheList(x) ReleaseCatCacheList(x) |