1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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 7103ebb7aa.

Reported-by: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAqTTAOzXiYybab+1DQOb3ZUuK99=p_KD+yrRFhcDbd0jg@mail.gmail.com
This commit is contained in:
Alvaro Herrera
2022-04-12 15:19:57 +02:00
parent 4533de358d
commit 183c869e1c

View File

@ -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)