1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

Fix some near-bugs related to ResourceOwner function arguments

These functions took a ResourceOwner argument, but only checked if it
was NULL, and then used CurrentResourceOwner for the actual work.
Surely the intention was to use the passed-in resource owner. All
current callers passed CurrentResourceOwner or NULL, so this has no
consequences at the moment, but it's an accident waiting to happen for
future caller and extensions.

Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEze2Whnfv8VuRZaohE-Af+GxBA1SNfD_rXfm84Jv-958UCcJA@mail.gmail.com
Backpatch-through: 17
This commit is contained in:
Heikki Linnakangas
2025-12-10 11:43:16 +02:00
parent d0518e965e
commit 998d100cdb

View File

@@ -1638,7 +1638,7 @@ ReleaseCatCacheWithOwner(HeapTuple tuple, ResourceOwner resowner)
ct->refcount--;
if (resowner)
ResourceOwnerForgetCatCacheRef(CurrentResourceOwner, &ct->tuple);
ResourceOwnerForgetCatCacheRef(resowner, &ct->tuple);
if (
#ifndef CATCACHE_FORCE_RELEASE
@@ -2083,7 +2083,7 @@ ReleaseCatCacheListWithOwner(CatCList *list, ResourceOwner resowner)
Assert(list->refcount > 0);
list->refcount--;
if (resowner)
ResourceOwnerForgetCatCacheListRef(CurrentResourceOwner, list);
ResourceOwnerForgetCatCacheListRef(resowner, list);
if (
#ifndef CATCACHE_FORCE_RELEASE