* the optimizer's simplify_boolean_equality() may
* have reduced this to just "CaseTestExpr" or
* "NOT CaseTestExpr", for which we have to show
- * "TRUE" or "FALSE".
+ * "TRUE" or "FALSE". Also, depending on context
+ * the original CaseTestExpr might have been reduced
+ * to a Const (but we won't see "WHEN Const").
*/
if (IsA(w, OpExpr))
{
Node *rhs;
Assert(IsA(linitial(((OpExpr *) w)->args),
- CaseTestExpr));
+ CaseTestExpr) ||
+ IsA(linitial(((OpExpr *) w)->args),
+ Const));
rhs = (Node *) lsecond(((OpExpr *) w)->args);
get_rule_expr(rhs, context, false);
}