|
2 | 2 | * ruleutils.c- Functions to convert stored expressions/querytrees
|
3 | 3 | *back to source text
|
4 | 4 | *
|
5 |
| - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.232 2006/08/21 00:57:25 tgl Exp $ |
| 5 | + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.233 2006/10/01 17:23:38 tgl Exp $ |
6 | 6 | **********************************************************************/
|
7 | 7 |
|
8 | 8 | #include"postgres.h"
|
@@ -3584,14 +3584,18 @@ get_rule_expr(Node *node, deparse_context *context,
|
3584 | 3584 | * the optimizer's simplify_boolean_equality() may
|
3585 | 3585 | * have reduced this to just "CaseTestExpr" or
|
3586 | 3586 | * "NOT CaseTestExpr", for which we have to show
|
3587 |
| - * "TRUE" or "FALSE". |
| 3587 | + * "TRUE" or "FALSE". Also, depending on context |
| 3588 | + * the original CaseTestExpr might have been reduced |
| 3589 | + * to a Const (but we won't see "WHEN Const"). |
3588 | 3590 | */
|
3589 | 3591 | if (IsA(w,OpExpr))
|
3590 | 3592 | {
|
3591 | 3593 | Node*rhs;
|
3592 | 3594 |
|
3593 | 3595 | Assert(IsA(linitial(((OpExpr*)w)->args),
|
3594 |
| -CaseTestExpr)); |
| 3596 | +CaseTestExpr)|| |
| 3597 | +IsA(linitial(((OpExpr*)w)->args), |
| 3598 | +Const)); |
3595 | 3599 | rhs= (Node*)lsecond(((OpExpr*)w)->args);
|
3596 | 3600 | get_rule_expr(rhs,context, false);
|
3597 | 3601 | }
|
|