From d2158b02813bb44116988eeb10d9a32565b58c1c Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Wed, 24 May 2006 11:01:39 +0000 Subject: * Add support NULL to GiST. * some refactoring and simplify code int gistutil.c and gist.c * now in some cases it can be called used-defined picksplit method for non-first column in index, but here is a place to do more. * small fix of docs related to support NULL. --- src/backend/access/gist/gistget.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/backend/access/gist/gistget.c') 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, -- cgit v1.2.3