]> granicus.if.org Git - postgresql/commitdiff
get_relattval() should treat a NULL constant as a non-constant expression,
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Apr 2000 01:55:45 +0000 (01:55 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Apr 2000 01:55:45 +0000 (01:55 +0000)
since it has no way to indicate to its caller that the constant is
actually NULL.  This prevents coredump in cases like
  WHERE textfield < null::text;

src/backend/optimizer/util/clauses.c

index 7ddbe4190cc0ca28419d368c22033b674cdbd22f..0404dce9385bcdaf468bf57854979a718c0db5f7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.65 2000/04/12 17:15:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.66 2000/04/16 01:55:45 tgl Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -790,7 +790,8 @@ default_results:
 
        other = (*flag == 0) ? left : right;
 
-       if (IsA(other, Const))
+       if (IsA(other, Const) &&
+               !((Const *) other)->constisnull)
        {
                *constval = ((Const *) other)->constvalue;
                *flag |= SEL_CONSTANT;