diff options
Diffstat (limited to 'src/backend/catalog/partition.c')
-rw-r--r-- | src/backend/catalog/partition.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c index 5f85b9b99ca..3c2bec25b9e 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog/partition.c @@ -181,17 +181,14 @@ index_get_partition(Relation partition, Oid indexId) } /* - * map_partition_varattnos - maps varattno of any Vars in expr from the - * attno's of 'from_rel' to the attno's of 'to_rel' partition, each of which - * may be either a leaf partition or a partitioned table, but both of which - * must be from the same partitioning hierarchy. + * map_partition_varattnos - maps varattnos of all Vars in 'expr' (that have + * varno 'fromrel_varno') from the attnums of 'from_rel' to the attnums of + * 'to_rel', each of which may be either a leaf partition or a partitioned + * table, but both of which must be from the same partitioning hierarchy. * - * Even though all of the same column names must be present in all relations - * in the hierarchy, and they must also have the same types, the attnos may - * be different. - * - * If found_whole_row is not NULL, *found_whole_row returns whether a - * whole-row variable was found in the input expression. + * We need this because even though all of the same column names must be + * present in all relations in the hierarchy, and they must also have the + * same types, the attnums may be different. * * Note: this will work on any node tree, so really the argument and result * should be declared "Node *". But a substantial majority of the callers @@ -199,14 +196,12 @@ index_get_partition(Relation partition, Oid indexId) */ List * map_partition_varattnos(List *expr, int fromrel_varno, - Relation to_rel, Relation from_rel, - bool *found_whole_row) + Relation to_rel, Relation from_rel) { - bool my_found_whole_row = false; - if (expr != NIL) { AttrMap *part_attmap; + bool found_whole_row; part_attmap = build_attrmap_by_name(RelationGetDescr(to_rel), RelationGetDescr(from_rel)); @@ -214,12 +209,10 @@ map_partition_varattnos(List *expr, int fromrel_varno, fromrel_varno, 0, part_attmap, RelationGetForm(to_rel)->reltype, - &my_found_whole_row); + &found_whole_row); + /* Since we provided a to_rowtype, we may ignore found_whole_row. */ } - if (found_whole_row) - *found_whole_row = my_found_whole_row; - return expr; } |