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

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.
This commit is contained in:
Robert Haas
2017-01-04 14:56:37 -05:00
parent f1b4c771ea
commit 18fc5192a6
5 changed files with 12 additions and 13 deletions

View 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

View 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);

View 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.

View File

@ -1228,7 +1228,7 @@ get_relation_constraints(PlannerInfo *root,
}
/* Append partition predicates, if any */
pcqual = RelationGetPartitionQual(relation, true);
pcqual = RelationGetPartitionQual(relation);
if (pcqual)
{
/*

View 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,