aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r--src/backend/access/gist/gistget.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 55d45b4a038..dcb8f2da54b 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.56 2006/03/05 15:58:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.57 2006/05/24 11:01:39 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@@ -361,7 +361,7 @@ gistindex_keytest(IndexTuple tuple,
IncrIndexProcessed();
/*
- * Tuple doesn't restore after crash recovery because of inclomplete
+ * Tuple doesn't restore after crash recovery because of incomplete
* insert
*/
if (!GistPageIsLeaf(p) && GistTupleIsInvalid(tuple))
@@ -378,14 +378,15 @@ gistindex_keytest(IndexTuple tuple,
key->sk_attno,
giststate->tupdesc,
&isNull);
- /* is the index entry NULL? */
- if (isNull)
- {
- /* XXX eventually should check if SK_ISNULL */
+
+ if ( key->sk_flags & SK_ISNULL ) {
+ /* is the compared-to datum NULL? on non-leaf page it's possible
+ to have nulls in childs :( */
+
+ if ( isNull || !GistPageIsLeaf(p) )
+ return true;
return false;
- }
- /* is the compared-to datum NULL? */
- if (key->sk_flags & SK_ISNULL)
+ } else if ( isNull )
return false;
gistdentryinit(giststate, key->sk_attno - 1, &de,