summaryrefslogtreecommitdiff
path: root/src/backend/commands/analyze.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-03-07 11:24:51 -0500
committerRobert Haas <rhaas@postgresql.org>2017-03-07 11:27:21 -0500
commitd88d06cd0783933b7103d42d3f101baa22b37292 (patch)
treebd7d165f9c9ba827f7e90de7e9f0ebcfe697a9e0 /src/backend/commands/analyze.c
parent508dabaf39e1f66cbe3fc54d2b66f010aa59c66b (diff)
Fix relcache reference leak.
Reported by Kevin Grittner. Faulty commit identified by Tom Lane. Patch by Amit Langote, reviewed by Michael Paquier. Discussion: http://postgr.es/m/CACjxUsOHbH1=99u8mGxmLHfy5hov4ENEpvM6=3ARjos7wG7rtQ@mail.gmail.com
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r--src/backend/commands/analyze.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index a70c7603416..b91df986c54 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -1360,11 +1360,14 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
else
{
/*
- * ignore, but release the lock on it. could be a partitioned
- * table.
+ * ignore, but release the lock on it. don't try to unlock the
+ * passed-in relation
*/
+ Assert(childrel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
if (childrel != onerel)
heap_close(childrel, AccessShareLock);
+ else
+ heap_close(childrel, NoLock);
continue;
}