Skip to content

Commit 89cbe72

Browse files
amitlanCommitfest Bot
authored and
Commitfest Bot
committed
Add assertion to verify derived clause has constant RHS
find_derived_clause_for_ec_member() searches for a previously-derived clause that equates a non-constant EquivalenceMember to a constant. It is only called for EquivalenceClasses with ec_has_const set, and with a non-constant member the EquivalenceMember to search for. The matched clause is expected to have the non-constant member on the left-hand side and the constant EquivalenceMember on the right. Assert that the RHS is indeed a constant, to catch violations of this structure and enforce assumptions made by generate_base_implied_equalities_const(). Author: Ashutosh Bapat <[email protected]> Discussion: https://postgr.es/m/CAExHW5scMxyFRqOFE6ODmBiW2rnVBEmeEcA-p4W_CyuEikURdA@mail.gmail.com
1 parent a7187c3 commit 89cbe72

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/optimizer/path/equivclass.c

+3
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,10 @@ find_derived_clause_for_ec_member(EquivalenceClass *ec,
26642664
* members on the left side of derived clauses.
26652665
*/
26662666
if (rinfo->left_em == em)
2667+
{
2668+
Assert(rinfo->right_em->em_is_const);
26672669
return rinfo;
2670+
}
26682671
}
26692672
return NULL;
26702673
}

0 commit comments

Comments
 (0)