diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-06-01 14:41:18 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-06-01 14:41:18 +0900 |
commit | ce1c5b9ae87b6153d3f40a4f7806f2effef12363 (patch) | |
tree | 4b9bdb98be64ff9894dbbc98c4452d1f04104712 /src/backend/utils/adt/tid.c | |
parent | e786be5fcb257a09b05bd8e509c8d1b82e626352 (diff) | |
download | postgresql-ce1c5b9ae87b6153d3f40a4f7806f2effef12363.tar.gz postgresql-ce1c5b9ae87b6153d3f40a4f7806f2effef12363.zip |
Fix use-after-release mistake in currtid() and currtid2() for views
This issue has been present since the introduction of this code as of
a3519a2 from 2002, and has been found by buildfarm member prion that
uses RELCACHE_FORCE_RELEASE via the tests introduced recently in
e786be5.
Discussion: https://postgr.es/m/20200601022055.GB4121@paquier.xyz
Backpatch-through: 9.5
Diffstat (limited to 'src/backend/utils/adt/tid.c')
-rw-r--r-- | src/backend/utils/adt/tid.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index cc699ee2f42..509a0fdffcd 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -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; } } } |