aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execPartition.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-04-12 15:19:57 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-04-12 15:19:57 +0200
commit183c869e1cbf69e7f5408ccb2121d37deec9956e (patch)
tree5eecf66d2660dcfc53d314f9ca204ea6ec6a81ad /src/backend/executor/execPartition.c
parent4533de358dd5f2a8930e3a73bcb49103b37357be (diff)
downloadpostgresql-183c869e1cbf69e7f5408ccb2121d37deec9956e.tar.gz
postgresql-183c869e1cbf69e7f5408ccb2121d37deec9956e.zip
adjust_partition_colnos mustn't be called if not needed
Add an assert to make this very explicit, as well as a code comment. The former should silence Coverity complaining about this. Introduced by 7103ebb7aae8. Reported-by: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAqTTAOzXiYybab+1DQOb3ZUuK99=p_KD+yrRFhcDbd0jg@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execPartition.c')
-rw-r--r--src/backend/executor/execPartition.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 615bd809735..e03ea27299c 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -1530,12 +1530,16 @@ ExecBuildSlotPartitionKeyDescription(Relation rel,
* adjust_partition_colnos
* Adjust the list of UPDATE target column numbers to account for
* attribute differences between the parent and the partition.
+ *
+ * Note: mustn't be called if no adjustment is required.
*/
static List *
adjust_partition_colnos(List *colnos, ResultRelInfo *leaf_part_rri)
{
TupleConversionMap *map = ExecGetChildToRootMap(leaf_part_rri);
+ Assert(map != NULL);
+
return adjust_partition_colnos_using_map(colnos, map->attrMap);
}
@@ -1543,6 +1547,8 @@ adjust_partition_colnos(List *colnos, ResultRelInfo *leaf_part_rri)
* adjust_partition_colnos_using_map
* Like adjust_partition_colnos, but uses a caller-supplied map instead
* of assuming to map from the "root" result relation.
+ *
+ * Note: mustn't be called if no adjustment is required.
*/
static List *
adjust_partition_colnos_using_map(List *colnos, AttrMap *attrMap)