Skip to content

Commit 18fc519

Browse files
committed
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.
1 parent f1b4c77 commit 18fc519

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

src/backend/catalog/partition.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static List *get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec);
122122
static List *get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec);
123123
static Oid get_partition_operator(PartitionKey key, int col,
124124
StrategyNumber strategy, bool *need_relabel);
125-
static List *generate_partition_qual(Relation rel, bool recurse);
125+
static List *generate_partition_qual(Relation rel);
126126

127127
static PartitionRangeBound *make_one_range_bound(PartitionKey key, int index,
128128
List *datums, bool lower);
@@ -914,13 +914,13 @@ get_qual_from_partbound(Relation rel, Relation parent, Node *bound)
914914
* Returns a list of partition quals
915915
*/
916916
List *
917-
RelationGetPartitionQual(Relation rel, bool recurse)
917+
RelationGetPartitionQual(Relation rel)
918918
{
919919
/* Quick exit */
920920
if (!rel->rd_rel->relispartition)
921921
return NIL;
922922

923-
return generate_partition_qual(rel, recurse);
923+
return generate_partition_qual(rel);
924924
}
925925

926926
/*
@@ -1480,7 +1480,7 @@ get_partition_operator(PartitionKey key, int col, StrategyNumber strategy,
14801480
* into cache memory.
14811481
*/
14821482
static List *
1483-
generate_partition_qual(Relation rel, bool recurse)
1483+
generate_partition_qual(Relation rel)
14841484
{
14851485
HeapTuple tuple;
14861486
MemoryContext oldcxt;
@@ -1501,8 +1501,8 @@ generate_partition_qual(Relation rel, bool recurse)
15011501
/* Quick copy */
15021502
if (rel->rd_partcheck)
15031503
{
1504-
if (parent->rd_rel->relispartition && recurse)
1505-
result = list_concat(generate_partition_qual(parent, true),
1504+
if (parent->rd_rel->relispartition)
1505+
result = list_concat(generate_partition_qual(parent),
15061506
copyObject(rel->rd_partcheck));
15071507
else
15081508
result = copyObject(rel->rd_partcheck);
@@ -1528,11 +1528,11 @@ generate_partition_qual(Relation rel, bool recurse)
15281528
my_qual = get_qual_from_partbound(rel, parent, bound);
15291529

15301530
/* If requested, add parent's quals to the list (if any) */
1531-
if (parent->rd_rel->relispartition && recurse)
1531+
if (parent->rd_rel->relispartition)
15321532
{
15331533
List *parent_check;
15341534

1535-
parent_check = generate_partition_qual(parent, true);
1535+
parent_check = generate_partition_qual(parent);
15361536
result = list_concat(parent_check, my_qual);
15371537
}
15381538
else

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13151,7 +13151,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1315113151
*/
1315213152
partConstraint = list_concat(get_qual_from_partbound(attachRel, rel,
1315313153
cmd->bound),
13154-
RelationGetPartitionQual(rel, true));
13154+
RelationGetPartitionQual(rel));
1315513155
partConstraint = (List *) eval_const_expressions(NULL,
1315613156
(Node *) partConstraint);
1315713157
partConstraint = (List *) canonicalize_qual((Expr *) partConstraint);

src/backend/executor/execMain.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
12591259
resultRelInfo->ri_projectReturning = NULL;
12601260
if (load_partition_check)
12611261
resultRelInfo->ri_PartitionCheck =
1262-
RelationGetPartitionQual(resultRelationDesc,
1263-
true);
1262+
RelationGetPartitionQual(resultRelationDesc);
12641263
/*
12651264
* The following gets set to NULL unless we are initializing leaf
12661265
* partitions for tuple-routing.

src/backend/optimizer/util/plancat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ get_relation_constraints(PlannerInfo *root,
12281228
}
12291229

12301230
/* Append partition predicates, if any */
1231-
pcqual = RelationGetPartitionQual(relation, true);
1231+
pcqual = RelationGetPartitionQual(relation);
12321232
if (pcqual)
12331233
{
12341234
/*

src/include/catalog/partition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern bool partition_bounds_equal(PartitionKey key,
7777
extern void check_new_partition_bound(char *relname, Relation parent, Node *bound);
7878
extern Oid get_partition_parent(Oid relid);
7979
extern List *get_qual_from_partbound(Relation rel, Relation parent, Node *bound);
80-
extern List *RelationGetPartitionQual(Relation rel, bool recurse);
80+
extern List *RelationGetPartitionQual(Relation rel);
8181

8282
/* For tuple routing */
8383
extern PartitionDispatch *RelationGetPartitionDispatchInfo(Relation rel,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy