Skip to content
Snippets Groups Projects
Commit 17804fa7 authored by Tom Lane's avatar Tom Lane
Browse files

Prefer actual constants to pseudo-constants in equivalence class machinery.

generate_base_implied_equalities_const() should prefer plain Consts over
other em_is_const eclass members when choosing the "pivot" value that
all the other members will be equated to.  This makes it more likely that
the generated equalities will be useful in constraint-exclusion proofs.
Per report from Rushabh Lathia.
parent 5a39114f
No related branches found
No related tags found
No related merge requests found
......@@ -769,7 +769,12 @@ generate_base_implied_equalities_const(PlannerInfo *root,
}
}
/* Find the constant member to use */
/*
* Find the constant member to use. We prefer an actual constant to
* pseudo-constants (such as Params), because the constraint exclusion
* machinery might be able to exclude relations on the basis of generated
* "var = const" equalities, but "var = param" won't work for that.
*/
foreach(lc, ec->ec_members)
{
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc);
......@@ -777,6 +782,7 @@ generate_base_implied_equalities_const(PlannerInfo *root,
if (cur_em->em_is_const)
{
const_em = cur_em;
if (IsA(cur_em->em_expr, Const))
break;
}
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment