Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeeb356

Browse files
committed
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 keysto set during key initialization. If key is NULL and SK_SEARCHNULL is notset 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.
1 parente034e51 commitbeeb356

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

‎src/backend/access/gist/gistget.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.75 2008/08/23 10:37:24 teodor Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.76 2008/10/17 17:02:21 teodor Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -134,6 +134,9 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
134134

135135
so= (GISTScanOpaque)scan->opaque;
136136

137+
if (so->qual_ok== false )
138+
return0;
139+
137140
if (ItemPointerIsValid(&so->curpos)== false)
138141
{
139142
/* Being asked to fetch the first entry, so start at the root */

‎src/backend/access/gist/gistscan.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.71 2008/08/23 10:37:24 teodor Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.72 2008/10/17 17:02:21 teodor Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -98,9 +98,19 @@ gistrescan(PG_FUNCTION_ARGS)
9898
* function in the form of its strategy number, which is available
9999
* from the sk_strategy field, and its subtype from the sk_subtype
100100
* field.
101+
*
102+
* Next, if any of keys is a NULL and that key is not marked with
103+
* SK_SEARCHNULL then nothing can be found.
101104
*/
102-
for (i=0;i<scan->numberOfKeys;i++)
105+
so->qual_ok= true;
106+
for (i=0;i<scan->numberOfKeys;i++) {
103107
scan->keyData[i].sk_func=so->giststate->consistentFn[scan->keyData[i].sk_attno-1];
108+
109+
if (scan->keyData[i].sk_flags&SK_ISNULL ) {
110+
if ( (scan->keyData[i].sk_flags&SK_SEARCHNULL)==0 )
111+
so->qual_ok= false;
112+
}
113+
}
104114
}
105115

106116
PG_RETURN_VOID();

‎src/include/access/gist_private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.32 2008/08/23 10:37:24 teodor Exp $
10+
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.33 2008/10/17 17:02:21 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -73,6 +73,7 @@ typedef struct GISTScanOpaqueData
7373
GISTSearchStack*stack;
7474
GISTSearchStack*markstk;
7575
uint16flags;
76+
boolqual_ok;/* false if qual can never be satisfied */
7677
GISTSTATE*giststate;
7778
MemoryContexttempCxt;
7879
Buffercurbuf;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp