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

Commitb1f7ee9

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 parent9619fdc commitb1f7ee9

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
@@ -611,15 +611,21 @@ generate_base_implied_equalities_const(PlannerInfo *root,
611611
}
612612
}
613613

614-
/* Find the constant member to use */
614+
/*
615+
* Find the constant member to use. We prefer an actual constant to
616+
* pseudo-constants (such as Params), because the constraint exclusion
617+
* machinery might be able to exclude relations on the basis of generated
618+
* "var = const" equalities, but "var = param" won't work for that.
619+
*/
615620
foreach(lc,ec->ec_members)
616621
{
617622
EquivalenceMember*cur_em= (EquivalenceMember*)lfirst(lc);
618623

619624
if (cur_em->em_is_const)
620625
{
621626
const_em=cur_em;
622-
break;
627+
if (IsA(cur_em->em_expr,Const))
628+
break;
623629
}
624630
}
625631
Assert(const_em!=NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp