]> granicus.if.org Git - postgresql/commitdiff
Fix: Operand Order Affects OR.
authorVadim B. Mikheev <vadim4o@yahoo.com>
Mon, 22 Sep 1997 04:19:36 +0000 (04:19 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Mon, 22 Sep 1997 04:19:36 +0000 (04:19 +0000)
where x <> 1 or x isnull
didn't return tuples with x NULL.

src/backend/executor/execQual.c

index 2f351276d4bf2ea99bc0bda7a6961390e8698595..4d96bdb0ada0f7a10b610b4927d458b99e2bff50 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.17 1997/09/12 04:07:36 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.18 1997/09/22 04:19:36 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1044,7 +1044,22 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
                 * ----------------
                 */
                if (*isNull)
+               {
                        IsNull = *isNull;
+                       /*
+                        * Many functions don't (or can't!) check is an argument
+                        * NULL or NOT_NULL and may return TRUE (1) with *isNull TRUE
+                        * (an_int4_column <> 1: int4ne returns TRUE for NULLs).
+                        * Not having time to fix function manager I want to fix
+                        * OR: if we had 'x <> 1 OR x isnull' then TRUE, TRUE were
+                        * returned by 'x <> 1' for NULL ... but ExecQualClause say
+                        * that qualification *fails* if isnull is TRUE for all values
+                        * returned by ExecEvalExpr. So, force this rule here: if isnull 
+                        * is TRUE then clause failed. Note: nullvalue() & nonnullvalue() 
+                        * always set isnull to FALSE for NULLs.        - vadim 09/22/97
+                        */
+                   const_value = 0;
+               }
 
                /* ----------------
                 *       if we have a true result, then we return it.