aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r--src/backend/access/gist/gistget.c22
-rw-r--r--src/backend/access/gist/gistscan.c13
2 files changed, 22 insertions, 13 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index a094495b8a9..98104a7a9f4 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.82 2009/10/08 22:34:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.83 2010/01/01 21:53:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -413,14 +413,20 @@ gistindex_keytest(IndexTuple tuple,
{
/*
* On non-leaf page we can't conclude that child hasn't NULL
- * values because of assumption in GiST: uinon (VAL, NULL) is VAL
- * But if on non-leaf page key IS NULL then all childs has NULL.
+ * values because of assumption in GiST: union (VAL, NULL) is VAL.
+ * But if on non-leaf page key IS NULL, then all children are NULL.
*/
-
- Assert(key->sk_flags & SK_SEARCHNULL);
-
- if (GistPageIsLeaf(p) && !isNull)
- return false;
+ if (key->sk_flags & SK_SEARCHNULL)
+ {
+ if (GistPageIsLeaf(p) && !isNull)
+ return false;
+ }
+ else
+ {
+ Assert(key->sk_flags & SK_SEARCHNOTNULL);
+ if (isNull)
+ return false;
+ }
}
else if (isNull)
{
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index aed3e95b4e3..dd43036524a 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.76 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.77 2010/01/01 21:53:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -92,15 +92,18 @@ gistrescan(PG_FUNCTION_ARGS)
* field.
*
* Next, if any of keys is a NULL and that key is not marked with
- * SK_SEARCHNULL then nothing can be found.
+ * SK_SEARCHNULL/SK_SEARCHNOTNULL then nothing can be found (ie,
+ * we assume all indexable operators are strict).
*/
for (i = 0; i < scan->numberOfKeys; i++)
{
- scan->keyData[i].sk_func = so->giststate->consistentFn[scan->keyData[i].sk_attno - 1];
+ ScanKey skey = &(scan->keyData[i]);
- if (scan->keyData[i].sk_flags & SK_ISNULL)
+ skey->sk_func = so->giststate->consistentFn[skey->sk_attno - 1];
+
+ if (skey->sk_flags & SK_ISNULL)
{
- if ((scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0)
+ if (!(skey->sk_flags & (SK_SEARCHNULL | SK_SEARCHNOTNULL)))
so->qual_ok = false;
}
}