* ruleutils.c - Functions to convert stored expressions/querytrees
* back to source text
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.232 2006/08/21 00:57:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.233 2006/10/01 17:23:38 tgl Exp $
**********************************************************************/
#include "postgres.h"
* 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);
}