mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-06 00:29:19 +02:00
Fix use-after-release mistake in currtid() and currtid2() for views
This issue has been present since the introduction of this code as ofa3519a2
from 2002, and has been found by buildfarm member prion that uses RELCACHE_FORCE_RELEASE via the tests introduced recently ine786be5
. Discussion: https://postgr.es/m/20200601022055.GB4121@paquier.xyz Backpatch-through: 9.5
This commit is contained in:
parent
95e389b3c2
commit
894041eb26
@ -338,8 +338,13 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
|
|||||||
rte = rt_fetch(var->varno, query->rtable);
|
rte = rt_fetch(var->varno, query->rtable);
|
||||||
if (rte)
|
if (rte)
|
||||||
{
|
{
|
||||||
|
Datum result;
|
||||||
|
|
||||||
|
result = DirectFunctionCall2(currtid_byreloid,
|
||||||
|
ObjectIdGetDatum(rte->relid),
|
||||||
|
PointerGetDatum(tid));
|
||||||
table_close(viewrel, AccessShareLock);
|
table_close(viewrel, AccessShareLock);
|
||||||
return DirectFunctionCall2(currtid_byreloid, ObjectIdGetDatum(rte->relid), PointerGetDatum(tid));
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user