From 1eb9221585c25cad1a563bc3414f697dae3fbc8b Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Thu, 16 Aug 2018 12:43:04 -0300 Subject: Fix executor prune failure when plan already pruned In a multi-layer partitioning setup, if at plan time all the sub-partitions are pruned but the intermediate one remains, the executor later throws a spurious error that there's nothing to prune. That is correct, but there's no reason to throw an error. Therefore, don't. Reported-by: Andreas Seltenreich Author: David Rowley Discussion: https://postgr.es/m/87in4h98i0.fsf@ansel.ydns.eu --- src/backend/executor/execPartition.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index d13be4145f8..1a9943c3aac 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -1886,8 +1886,13 @@ find_matching_subplans_recurse(PartitionPruningData *prunedata, initial_prune, validsubplans); else { - /* Shouldn't happen */ - elog(ERROR, "partition missing from subplans"); + /* + * We get here if the planner already pruned all the sub- + * partitions for this partition. Silently ignore this + * partition in this case. The end result is the same: we + * would have pruned all partitions just the same, but we + * don't have any pruning steps to execute to verify this. + */ } } } -- cgit v1.2.3