Commit ce1c5b9a authored by Michael Paquier's avatar Michael Paquier

Fix use-after-release mistake in currtid() and currtid2() for views

This issue has been present since the introduction of this code as of
a3519a2f from 2002, and has been found by buildfarm member prion that
uses RELCACHE_FORCE_RELEASE via the tests introduced recently in
e786be5f.

Discussion: https://postgr.es/m/20200601022055.GB4121@paquier.xyz
Backpatch-through: 9.5
parent e786be5f
......@@ -338,8 +338,13 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
rte = rt_fetch(var->varno, query->rtable);
if (rte)
{
Datum result;
result = DirectFunctionCall2(currtid_byreloid,
ObjectIdGetDatum(rte->relid),
PointerGetDatum(tid));
table_close(viewrel, AccessShareLock);
return DirectFunctionCall2(currtid_byreloid, ObjectIdGetDatum(rte->relid), PointerGetDatum(tid));
return result;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment