Commit 18fc5192 authored by Robert Haas's avatar Robert Haas

Remove unnecessary arguments from partitioning functions.

RelationGetPartitionQual() and generate_partition_qual() are always
called with recurse = true, so we don't need an argument for that.

Extracted by me from a larger patch by Amit Langote.
parent f1b4c771
...@@ -122,7 +122,7 @@ static List *get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec); ...@@ -122,7 +122,7 @@ static List *get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec);
static List *get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec); static List *get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec);
static Oid get_partition_operator(PartitionKey key, int col, static Oid get_partition_operator(PartitionKey key, int col,
StrategyNumber strategy, bool *need_relabel); StrategyNumber strategy, bool *need_relabel);
static List *generate_partition_qual(Relation rel, bool recurse); static List *generate_partition_qual(Relation rel);
static PartitionRangeBound *make_one_range_bound(PartitionKey key, int index, static PartitionRangeBound *make_one_range_bound(PartitionKey key, int index,
List *datums, bool lower); List *datums, bool lower);
...@@ -914,13 +914,13 @@ get_qual_from_partbound(Relation rel, Relation parent, Node *bound) ...@@ -914,13 +914,13 @@ get_qual_from_partbound(Relation rel, Relation parent, Node *bound)
* Returns a list of partition quals * Returns a list of partition quals
*/ */
List * List *
RelationGetPartitionQual(Relation rel, bool recurse) RelationGetPartitionQual(Relation rel)
{ {
/* Quick exit */ /* Quick exit */
if (!rel->rd_rel->relispartition) if (!rel->rd_rel->relispartition)
return NIL; return NIL;
return generate_partition_qual(rel, recurse); return generate_partition_qual(rel);
} }
/* /*
...@@ -1480,7 +1480,7 @@ get_partition_operator(PartitionKey key, int col, StrategyNumber strategy, ...@@ -1480,7 +1480,7 @@ get_partition_operator(PartitionKey key, int col, StrategyNumber strategy,
* into cache memory. * into cache memory.
*/ */
static List * static List *
generate_partition_qual(Relation rel, bool recurse) generate_partition_qual(Relation rel)
{ {
HeapTuple tuple; HeapTuple tuple;
MemoryContext oldcxt; MemoryContext oldcxt;
...@@ -1501,8 +1501,8 @@ generate_partition_qual(Relation rel, bool recurse) ...@@ -1501,8 +1501,8 @@ generate_partition_qual(Relation rel, bool recurse)
/* Quick copy */ /* Quick copy */
if (rel->rd_partcheck) if (rel->rd_partcheck)
{ {
if (parent->rd_rel->relispartition && recurse) if (parent->rd_rel->relispartition)
result = list_concat(generate_partition_qual(parent, true), result = list_concat(generate_partition_qual(parent),
copyObject(rel->rd_partcheck)); copyObject(rel->rd_partcheck));
else else
result = copyObject(rel->rd_partcheck); result = copyObject(rel->rd_partcheck);
...@@ -1528,11 +1528,11 @@ generate_partition_qual(Relation rel, bool recurse) ...@@ -1528,11 +1528,11 @@ generate_partition_qual(Relation rel, bool recurse)
my_qual = get_qual_from_partbound(rel, parent, bound); my_qual = get_qual_from_partbound(rel, parent, bound);
/* If requested, add parent's quals to the list (if any) */ /* If requested, add parent's quals to the list (if any) */
if (parent->rd_rel->relispartition && recurse) if (parent->rd_rel->relispartition)
{ {
List *parent_check; List *parent_check;
parent_check = generate_partition_qual(parent, true); parent_check = generate_partition_qual(parent);
result = list_concat(parent_check, my_qual); result = list_concat(parent_check, my_qual);
} }
else else
......
...@@ -13151,7 +13151,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd) ...@@ -13151,7 +13151,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
*/ */
partConstraint = list_concat(get_qual_from_partbound(attachRel, rel, partConstraint = list_concat(get_qual_from_partbound(attachRel, rel,
cmd->bound), cmd->bound),
RelationGetPartitionQual(rel, true)); RelationGetPartitionQual(rel));
partConstraint = (List *) eval_const_expressions(NULL, partConstraint = (List *) eval_const_expressions(NULL,
(Node *) partConstraint); (Node *) partConstraint);
partConstraint = (List *) canonicalize_qual((Expr *) partConstraint); partConstraint = (List *) canonicalize_qual((Expr *) partConstraint);
......
...@@ -1259,8 +1259,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, ...@@ -1259,8 +1259,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
resultRelInfo->ri_projectReturning = NULL; resultRelInfo->ri_projectReturning = NULL;
if (load_partition_check) if (load_partition_check)
resultRelInfo->ri_PartitionCheck = resultRelInfo->ri_PartitionCheck =
RelationGetPartitionQual(resultRelationDesc, RelationGetPartitionQual(resultRelationDesc);
true);
/* /*
* The following gets set to NULL unless we are initializing leaf * The following gets set to NULL unless we are initializing leaf
* partitions for tuple-routing. * partitions for tuple-routing.
......
...@@ -1228,7 +1228,7 @@ get_relation_constraints(PlannerInfo *root, ...@@ -1228,7 +1228,7 @@ get_relation_constraints(PlannerInfo *root,
} }
/* Append partition predicates, if any */ /* Append partition predicates, if any */
pcqual = RelationGetPartitionQual(relation, true); pcqual = RelationGetPartitionQual(relation);
if (pcqual) if (pcqual)
{ {
/* /*
......
...@@ -77,7 +77,7 @@ extern bool partition_bounds_equal(PartitionKey key, ...@@ -77,7 +77,7 @@ extern bool partition_bounds_equal(PartitionKey key,
extern void check_new_partition_bound(char *relname, Relation parent, Node *bound); extern void check_new_partition_bound(char *relname, Relation parent, Node *bound);
extern Oid get_partition_parent(Oid relid); extern Oid get_partition_parent(Oid relid);
extern List *get_qual_from_partbound(Relation rel, Relation parent, Node *bound); extern List *get_qual_from_partbound(Relation rel, Relation parent, Node *bound);
extern List *RelationGetPartitionQual(Relation rel, bool recurse); extern List *RelationGetPartitionQual(Relation rel);
/* For tuple routing */ /* For tuple routing */
extern PartitionDispatch *RelationGetPartitionDispatchInfo(Relation rel, extern PartitionDispatch *RelationGetPartitionDispatchInfo(Relation rel,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment