aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-06-11 19:17:50 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-06-11 19:18:04 -0400
commitbdc643e5e46f84d55d989980e4ff5f8e2da103c6 (patch)
tree682b3def57cb380cc965d0845ff927b0737d13c9 /src/backend/commands/tablecmds.c
parentf8795d2ec8632a7242896e0f8322d13bfe922512 (diff)
downloadpostgresql-bdc643e5e46f84d55d989980e4ff5f8e2da103c6.tar.gz
postgresql-bdc643e5e46f84d55d989980e4ff5f8e2da103c6.zip
Fix access to just-closed relcache entry.
It might be impossible for this to cause a problem in non-debug builds, since there'd be no opportunity for the relcache entry to get recycled before the fetch. It blows up nicely with -DRELCACHE_FORCE_RELEASE plus valgrind, though. Evidently introduced by careless refactoring in commit f0e44751d. Back-patch accordingly. Discussion: https://postgr.es/m/27543.1528758304@sss.pgh.pa.us
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0e95037dcf4..d20991a1e56 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -11922,12 +11922,12 @@ ATExecDropInherit(Relation rel, RangeVar *parent, LOCKMODE lockmode)
/* Off to RemoveInheritance() where most of the work happens */
RemoveInheritance(rel, parent_rel);
- /* keep our lock on the parent relation until commit */
- heap_close(parent_rel, NoLock);
-
ObjectAddressSet(address, RelationRelationId,
RelationGetRelid(parent_rel));
+ /* keep our lock on the parent relation until commit */
+ heap_close(parent_rel, NoLock);
+
return address;
}