Skip to content

Commit 7fe22f5

Browse files
committed
Back-patch fix for NULL condition in CASE.
1 parent bed8cf4 commit 7fe22f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/executor/execQual.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.53 1999/06/12 19:22:40 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.53.2.1 1999/09/18 23:30:05 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1128,9 +1128,10 @@ ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext, bool *isNull)
11281128

11291129
/*
11301130
* if we have a true test, then we return the result, since the
1131-
* case statement is satisfied.
1131+
* case statement is satisfied. A NULL result from the test is
1132+
* not considered true.
11321133
*/
1133-
if (DatumGetInt32(const_value) != 0)
1134+
if (DatumGetInt32(const_value) != 0 && ! *isNull)
11341135
{
11351136
const_value = ExecEvalExpr((Node *) wclause->result,
11361137
econtext,

0 commit comments

Comments
 (0)