diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2008-10-17 17:02:42 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2008-10-17 17:02:42 +0000 |
commit | 2cae6fe7179c49197f22dec7292095764c4e9eaa (patch) | |
tree | c5b7c12497955a97d721ea2e0935941634bd9fd2 /src/backend/access/gist/gistscan.c | |
parent | 6a6f47d00a7505e1b5d562321386253133e05367 (diff) | |
download | postgresql-2cae6fe7179c49197f22dec7292095764c4e9eaa.tar.gz postgresql-2cae6fe7179c49197f22dec7292095764c4e9eaa.zip |
During repeated rescan of GiST index it's possible that scan key
is NULL but SK_SEARCHNULL is not set. Add checking IS NULL of keys
to set during key initialization. If key is NULL and SK_SEARCHNULL is not
set then nothnig can be satisfied.
With assert-enabled compilation that causes coredump.
Bug was introduced in 8.3 by support of IS NULL index scan.
Diffstat (limited to 'src/backend/access/gist/gistscan.c')
-rw-r--r-- | src/backend/access/gist/gistscan.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 88e1c6ecbee..31fb549e53f 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.68.2.1 2008/08/23 10:40:03 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.68.2.2 2008/10/17 17:02:42 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -96,9 +96,19 @@ gistrescan(PG_FUNCTION_ARGS) * function in the form of its strategy number, which is available * from the sk_strategy field, and its subtype from the sk_subtype * field. + * + * Next, if any of keys is a NULL and that key is not marked with + * SK_SEARCHNULL then nothing can be found. */ - for (i = 0; i < scan->numberOfKeys; i++) + so->qual_ok = true; + for (i = 0; i < scan->numberOfKeys; i++) { scan->keyData[i].sk_func = so->giststate->consistentFn[scan->keyData[i].sk_attno - 1]; + + if ( scan->keyData[i].sk_flags & SK_ISNULL ) { + if ( (scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0 ) + so->qual_ok = false; + } + } } PG_RETURN_VOID(); |