aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execPartition.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2018-04-05 09:54:07 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2018-04-05 09:54:07 +0100
commit4b2d44031f8c005f6f86364d7663858b6b5bdd14 (patch)
tree821dec0027fe8caa8ce50250e20a1e594d738e7e /src/backend/executor/execPartition.c
parent1fd8690668635bab9dfa16b2885e6e474f8451ba (diff)
downloadpostgresql-4b2d44031f8c005f6f86364d7663858b6b5bdd14.tar.gz
postgresql-4b2d44031f8c005f6f86364d7663858b6b5bdd14.zip
MERGE post-commit review
Review comments from Andres Freund * Consolidate code into AfterTriggerGetTransitionTable() * Rename nodeMerge.c to execMerge.c * Rename nodeMerge.h to execMerge.h * Move MERGE handling in ExecInitModifyTable() into a execMerge.c ExecInitMerge() * Move mt_merge_subcommands flags into execMerge.h * Rename opt_and_condition to opt_merge_when_and_condition * Wordsmith various comments Author: Pavan Deolasee Reviewer: Simon Riggs
Diffstat (limited to 'src/backend/executor/execPartition.c')
-rw-r--r--src/backend/executor/execPartition.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index a6a7885abd1..007f00569ce 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -313,6 +313,10 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
/*
* Given OID of the partition leaf, return the index of the leaf in the
* partition hierarchy.
+ *
+ * NB: This is an O(N) operation. Unfortunately, there are many other problem
+ * areas with more than a handful partitions, so we don't try to optimise this
+ * code right now.
*/
int
ExecFindPartitionByOid(PartitionTupleRouting *proute, Oid partoid)
@@ -325,7 +329,10 @@ ExecFindPartitionByOid(PartitionTupleRouting *proute, Oid partoid)
break;
}
- Assert(i < proute->num_partitions);
+ if (i >= proute->num_partitions)
+ ereport(ERROR,
+ (errcode(ERRCODE_INTERNAL_ERROR),
+ errmsg("no partition found for OID %u", partoid)));
return i;
}