]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fixes:
authorMarc G. Fournier <scrappy@hub.org>
Fri, 19 Jul 1996 07:14:14 +0000 (07:14 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Fri, 19 Jul 1996 07:14:14 +0000 (07:14 +0000)
Select queries with an isnull or notnull clause, like "select * where
somefield isnull", crash the backend if the table has at least one index.
If the indices are deleted the queries work again. Also the explain
command fail in the same way.
The is caused by a bug in subroutine of the optimizer which doesn't check
null values in the clauses.

Submitted by: Massimo Dal Zotto <dz@cs.unitn.it>

src/backend/optimizer/path/indxpath.c
src/backend/utils/adt/varlena.c

index 844571847f9b2cdb6379ab10487b8dcc94928ed7..e145554eed99817b2d4895a6a192e3d564ab9996 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.1.1.1 1996/07/09 06:21:35 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.2 1996/07/19 07:13:26 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -493,7 +493,7 @@ match_clause_to_indexkey(Rel *rel,
            /*
             * Check for standard s-argable clause
             */
-           if (IsA(rightop,Const))
+           if (rightop && IsA(rightop,Const))
                {
                    restrict_op = ((Oper*)((Expr*)clause)->oper)->opno;
                    isIndexable =
@@ -507,7 +507,7 @@ match_clause_to_indexkey(Rel *rel,
            /*
             * Must try to commute the clause to standard s-arg format.
             */
-           else if (IsA(leftop,Const))
+           else if (leftop && IsA(leftop,Const))
                {
                    restrict_op =
                        get_commutator(((Oper*)((Expr*)clause)->oper)->opno);
@@ -535,12 +535,14 @@ match_clause_to_indexkey(Rel *rel,
      */
     else
        {
-           if (match_index_to_operand(indexkey,(Expr*)rightop,rel,index)) {
+           if (rightop
+               && match_index_to_operand(indexkey,(Expr*)rightop,rel,index)) {
                                        
                join_op = get_commutator(((Oper*)((Expr*)clause)->oper)->opno);
 
-           } else if (match_index_to_operand(indexkey,
-                                             (Expr*)leftop,rel,index)) {
+           } else if (leftop
+                      && match_index_to_operand(indexkey,
+                                                (Expr*)leftop,rel,index)) {
                join_op = ((Oper*)((Expr*)clause)->oper)->opno;
            }
 
index e3f3c939306c24260400e19fa3f0bd06f8f29e28..7b186f02fe48c5069cb64c2c1a021deaff0594f2 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.2 1996/07/19 06:08:21 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.3 1996/07/19 07:14:14 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -198,8 +198,6 @@ textout(struct varlena *vlena)
 
 /* ========== PUBLIC ROUTINES ========== */
 
-/* 
-
 /*
  * textlen -
  *    returns the actual length of a text* (which may be less than