1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Cosmetic improvements for code related to partitionwise join.

Move have_partkey_equi_join and match_expr_to_partition_keys to
relnode.c, since they're used only there.  Refactor
build_joinrel_partition_info to split out the code that fills the
joinrel's partition key lists; this doesn't have any non-cosmetic
impact, but it seems like a useful separation of concerns.
Improve assorted nearby comments.

Amit Langote, with a little further editorialization by me

Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com
This commit is contained in:
Tom Lane
2020-04-03 17:00:25 -04:00
parent 21dc48840c
commit 0568e7a2a4
5 changed files with 283 additions and 234 deletions

View File

@@ -2250,9 +2250,8 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
/*
* set_baserel_partition_key_exprs
*
* Builds partition key expressions for the given base relation and sets them
* in given RelOptInfo. Any single column partition keys are converted to Var
* nodes. All Var nodes are restamped with the relid of given relation.
* Builds partition key expressions for the given base relation and fills
* rel->partexprs.
*/
static void
set_baserel_partition_key_exprs(Relation relation,
@@ -2300,16 +2299,17 @@ set_baserel_partition_key_exprs(Relation relation,
lc = lnext(partkey->partexprs, lc);
}
/* Base relations have a single expression per key. */
partexprs[cnt] = list_make1(partexpr);
}
rel->partexprs = partexprs;
/*
* A base relation can not have nullable partition key expressions. We
* still allocate array of empty expressions lists to keep partition key
* expression handling code simple. See build_joinrel_partition_info() and
* match_expr_to_partition_keys().
* A base relation does not have nullable partition key expressions, since
* no outer join is involved. We still allocate an array of empty
* expression lists to keep partition key expression handling code simple.
* See build_joinrel_partition_info() and match_expr_to_partition_keys().
*/
rel->nullable_partexprs = (List **) palloc0(sizeof(List *) * partnatts);
}