Make gistindex_keytest safe against NULL values. Same fix was already
authorTom Lane <[email protected]>
Fri, 27 Aug 2004 17:47:56 +0000 (17:47 +0000)
committerTom Lane <[email protected]>
Fri, 27 Aug 2004 17:47:56 +0000 (17:47 +0000)
made in passing for 8.0, but now that we have a bug report showing it's
needed, we should put it into 7.4 branch.

src/backend/access/gist/gistget.c

index bfa557bb9c6356da87d0cd2ffe93bc928338dfcc..596c11e41e80fecd20c69f0af3145fbd2daa5ed0 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.36 2003/08/04 02:39:57 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.36.4.1 2004/08/27 17:47:56 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -234,16 +234,16 @@ gistindex_keytest(IndexTuple tuple,
                              key[0].sk_attno,
                              giststate->tupdesc,
                              &isNull);
+       /* is the index entry NULL? */
        if (isNull)
        {
            /* XXX eventually should check if SK_ISNULL */
            return false;
        }
-
-/* this code from backend/access/common/indexvalid.c. But why and what???
+       /* is the compared-to datum NULL? */
        if (key[0].sk_flags & SK_ISNULL)
            return false;
-*/
+
        gistdentryinit(giststate, key[0].sk_attno - 1, &de,
                       datum, r, p, offset,
                       IndexTupleSize(tuple) - sizeof(IndexTupleData),