Back-patch fix for NULL condition in CASE.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Sep 1999 23:30:05 +0000 (23:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Sep 1999 23:30:05 +0000 (23:30 +0000)
src/backend/executor/execQual.c

index 5f6787b7cb4305a008f63b0de61fbad7bb580b3f..2b8b47cc800bb1fdece866b0ee21e1c90334ab51 100644 (file)
@@ -1128,9 +1128,10 @@ ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext, bool *isNull)
 
                /*
                 * if we have a true test, then we return the result, since the
-                * case statement is satisfied.
+                * case statement is satisfied.  A NULL result from the test is
+                * not considered true.
                 */
-               if (DatumGetInt32(const_value) != 0)
+               if (DatumGetInt32(const_value) != 0 && ! *isNull)
                {
                        const_value = ExecEvalExpr((Node *) wclause->result,
                                                                           econtext,