Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff8f710

Browse files
committed
Prefer actual constants to pseudo-constants in equivalence class machinery.
generate_base_implied_equalities_const() should prefer plain Consts overother em_is_const eclass members when choosing the "pivot" value thatall the other members will be equated to. This makes it more likely thatthe generated equalities will be useful in constraint-exclusion proofs.Per report from Rushabh Lathia.
1 parent5110a96 commitff8f710

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎src/backend/optimizer/path/equivclass.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,15 +768,21 @@ generate_base_implied_equalities_const(PlannerInfo *root,
768768
}
769769
}
770770

771-
/* Find the constant member to use */
771+
/*
772+
* Find the constant member to use. We prefer an actual constant to
773+
* pseudo-constants (such as Params), because the constraint exclusion
774+
* machinery might be able to exclude relations on the basis of generated
775+
* "var = const" equalities, but "var = param" won't work for that.
776+
*/
772777
foreach(lc,ec->ec_members)
773778
{
774779
EquivalenceMember*cur_em= (EquivalenceMember*)lfirst(lc);
775780

776781
if (cur_em->em_is_const)
777782
{
778783
const_em=cur_em;
779-
break;
784+
if (IsA(cur_em->em_expr,Const))
785+
break;
780786
}
781787
}
782788
Assert(const_em!=NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp