1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Fix overly enthusiastic Assert introduced in 8.1: it's expecting a

CaseTestExpr, but forgot that the optimizer is sometimes able to replace
CaseTestExpr by Const.
This commit is contained in:
Tom Lane
2006-10-01 17:23:51 +00:00
parent e73687f2ec
commit 9acbb81dd7

View File

@ -3,7 +3,7 @@
* back to source text * back to source text
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.207.2.5 2006/01/26 17:08:26 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.207.2.6 2006/10/01 17:23:51 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
@ -3458,14 +3458,18 @@ get_rule_expr(Node *node, deparse_context *context,
* the optimizer's simplify_boolean_equality() may * the optimizer's simplify_boolean_equality() may
* have reduced this to just "CaseTestExpr" or * have reduced this to just "CaseTestExpr" or
* "NOT CaseTestExpr", for which we have to show * "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)) if (IsA(w, OpExpr))
{ {
Node *rhs; Node *rhs;
Assert(IsA(linitial(((OpExpr *) w)->args), Assert(IsA(linitial(((OpExpr *) w)->args),
CaseTestExpr)); CaseTestExpr) ||
IsA(linitial(((OpExpr *) w)->args),
Const));
rhs = (Node *) lsecond(((OpExpr *) w)->args); rhs = (Node *) lsecond(((OpExpr *) w)->args);
get_rule_expr(rhs, context, false); get_rule_expr(rhs, context, false);
} }