Remove unnecessary arguments from partitioning functions.
authorRobert Haas <rhaas@postgresql.org>
Wed, 4 Jan 2017 19:56:37 +0000 (14:56 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 4 Jan 2017 19:56:37 +0000 (14:56 -0500)
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.

src/backend/catalog/partition.c
src/backend/commands/tablecmds.c
src/backend/executor/execMain.c
src/backend/optimizer/util/plancat.c
src/include/catalog/partition.h

index e6eb5c9209f73bda1fa367e6b3621daadf4d389d..1542c122f18d44338b86a8224ddca94214d104ba 100644 (file)
@@ -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 Oid get_partition_operator(PartitionKey key, int col,
                       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,
                     List *datums, bool lower);
@@ -914,13 +914,13 @@ get_qual_from_partbound(Relation rel, Relation parent, Node *bound)
  * Returns a list of partition quals
  */
 List *
-RelationGetPartitionQual(Relation rel, bool recurse)
+RelationGetPartitionQual(Relation rel)
 {
    /* Quick exit */
    if (!rel->rd_rel->relispartition)
        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,
  * into cache memory.
  */
 static List *
-generate_partition_qual(Relation rel, bool recurse)
+generate_partition_qual(Relation rel)
 {
    HeapTuple   tuple;
    MemoryContext oldcxt;
@@ -1501,8 +1501,8 @@ generate_partition_qual(Relation rel, bool recurse)
    /* Quick copy */
    if (rel->rd_partcheck)
    {
-       if (parent->rd_rel->relispartition && recurse)
-           result = list_concat(generate_partition_qual(parent, true),
+       if (parent->rd_rel->relispartition)
+           result = list_concat(generate_partition_qual(parent),
                                 copyObject(rel->rd_partcheck));
        else
            result = copyObject(rel->rd_partcheck);
@@ -1528,11 +1528,11 @@ generate_partition_qual(Relation rel, bool recurse)
    my_qual = get_qual_from_partbound(rel, parent, bound);
 
    /* 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;
 
-       parent_check = generate_partition_qual(parent, true);
+       parent_check = generate_partition_qual(parent);
        result = list_concat(parent_check, my_qual);
    }
    else
index 7a5a574bbe2184d8e395451c12fa421f80cd4f33..f518c1371e6a2aa7fcb5de3eff086ff3a4549483 100644 (file)
@@ -13151,7 +13151,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
     */
    partConstraint = list_concat(get_qual_from_partbound(attachRel, rel,
                                                         cmd->bound),
-                                RelationGetPartitionQual(rel, true));
+                                RelationGetPartitionQual(rel));
    partConstraint = (List *) eval_const_expressions(NULL,
                                                     (Node *) partConstraint);
    partConstraint = (List *) canonicalize_qual((Expr *) partConstraint);
index d9ff5fa28bc80ac3919aa10e15b532d384b7c73d..ff277d300a8d553fe6c8cc3aad047bb6988a8cb2 100644 (file)
@@ -1259,8 +1259,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
    resultRelInfo->ri_projectReturning = NULL;
    if (load_partition_check)
        resultRelInfo->ri_PartitionCheck =
-                           RelationGetPartitionQual(resultRelationDesc,
-                                                    true);
+                           RelationGetPartitionQual(resultRelationDesc);
    /*
     * The following gets set to NULL unless we are initializing leaf
     * partitions for tuple-routing.
index 296a79a82a09aac327d4ee80358791dea5539b66..7836e6b3f85a67953849e5fcce4837de70fdcd30 100644 (file)
@@ -1228,7 +1228,7 @@ get_relation_constraints(PlannerInfo *root,
    }
 
    /* Append partition predicates, if any */
-   pcqual = RelationGetPartitionQual(relation, true);
+   pcqual = RelationGetPartitionQual(relation);
    if (pcqual)
    {
        /*
index 2a9bd48fdff03d91f7891e3786d436fca8b5d33b..1c3c4d6ac367744ac65c3e381962013dcc5608dd 100644 (file)
@@ -77,7 +77,7 @@ extern bool partition_bounds_equal(PartitionKey key,
 extern void check_new_partition_bound(char *relname, Relation parent, Node *bound);
 extern Oid get_partition_parent(Oid relid);
 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 */
 extern PartitionDispatch *RelationGetPartitionDispatchInfo(Relation rel,