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

Commit3afffbc

Browse files
committed
Remove support of backward scan in GiST. Per discussion
http://archives.postgresql.org/pgsql-hackers/2008-10/msg00857.php
1 parenta6ebb1f commit3afffbc

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

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

Lines changed: 15 additions & 25 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/gistget.c,v 1.77 2008/10/2013:39:44 teodor Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.78 2008/10/2016:35:14 teodor Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -23,9 +23,8 @@
2323
#include"utils/memutils.h"
2424

2525

26-
staticOffsetNumbergistfindnext(IndexScanDescscan,OffsetNumbern,
27-
ScanDirectiondir);
28-
staticint64gistnext(IndexScanDescscan,ScanDirectiondir,TIDBitmap*tbm);
26+
staticOffsetNumbergistfindnext(IndexScanDescscan,OffsetNumbern);
27+
staticint64gistnext(IndexScanDescscan,TIDBitmap*tbm);
2928
staticboolgistindex_keytest(IndexTupletuple,IndexScanDescscan,
3029
OffsetNumberoffset);
3130

@@ -80,6 +79,9 @@ gistgettuple(PG_FUNCTION_ARGS)
8079

8180
so= (GISTScanOpaque)scan->opaque;
8281

82+
if (dir!=ForwardScanDirection)
83+
elog(ERROR,"GiST doesn't support other scan directions than forward");
84+
8385
/*
8486
* If we have produced an index tuple in the past and the executor has
8587
* informed us we need to mark it as "killed", do so now.
@@ -90,7 +92,7 @@ gistgettuple(PG_FUNCTION_ARGS)
9092
/*
9193
* Get the next tuple that matches the search key.
9294
*/
93-
res= (gistnext(scan,dir,NULL)>0);
95+
res= (gistnext(scan,NULL)>0);
9496

9597
PG_RETURN_BOOL(res);
9698
}
@@ -102,7 +104,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
102104
TIDBitmap*tbm= (TIDBitmap*)PG_GETARG_POINTER(1);
103105
int64ntids;
104106

105-
ntids=gistnext(scan,ForwardScanDirection,tbm);
107+
ntids=gistnext(scan,tbm);
106108

107109
PG_RETURN_INT64(ntids);
108110
}
@@ -122,7 +124,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
122124
* non-killed tuple that matches the search key.
123125
*/
124126
staticint64
125-
gistnext(IndexScanDescscan,ScanDirectiondir,TIDBitmap*tbm)
127+
gistnext(IndexScanDescscan,TIDBitmap*tbm)
126128
{
127129
Pagep;
128130
OffsetNumbern;
@@ -169,9 +171,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
169171

170172
if (so->curPageData<so->nPageData )
171173
{
172-
/*
173-
* pageData is already ordered for scan's direction
174-
*/
175174
scan->xs_ctup.t_self=so->pageData[so->curPageData ].iptr;
176175
scan->xs_recheck=so->pageData[so->curPageData ].recheck;
177176
so->curPageData++;
@@ -252,17 +251,14 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
252251
continue;
253252
}
254253

255-
if (ScanDirectionIsBackward(dir))
256-
n=PageGetMaxOffsetNumber(p);
257-
else
258-
n=FirstOffsetNumber;
254+
n=FirstOffsetNumber;
259255

260256
/* wonderful, we can look at page */
261257
so->nPageData=so->curPageData=0;
262258

263259
for (;;)
264260
{
265-
n=gistfindnext(scan,n,dir);
261+
n=gistfindnext(scan,n);
266262

267263
if (!OffsetNumberIsValid(n))
268264
{
@@ -275,7 +271,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
275271
if ( !tbm&&so->nPageData>0 )
276272
{
277273
LockBuffer(so->curbuf,GIST_UNLOCK);
278-
returngistnext(scan,dir,NULL);
274+
returngistnext(scan,NULL);
279275
}
280276

281277
/*
@@ -346,10 +342,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
346342
so->stack->next=stk;
347343
}
348344

349-
if (ScanDirectionIsBackward(dir))
350-
n=OffsetNumberPrev(n);
351-
else
352-
n=OffsetNumberNext(n);
345+
n=OffsetNumberNext(n);
353346
}
354347
}
355348

@@ -475,7 +468,7 @@ gistindex_keytest(IndexTuple tuple,
475468
* Page should be locked....
476469
*/
477470
staticOffsetNumber
478-
gistfindnext(IndexScanDescscan,OffsetNumbern,ScanDirectiondir)
471+
gistfindnext(IndexScanDescscan,OffsetNumbern)
479472
{
480473
OffsetNumbermaxoff;
481474
IndexTupleit;
@@ -500,10 +493,7 @@ gistfindnext(IndexScanDesc scan, OffsetNumber n, ScanDirection dir)
500493
if (gistindex_keytest(it,scan,n))
501494
break;
502495

503-
if (ScanDirectionIsBackward(dir))
504-
n=OffsetNumberPrev(n);
505-
else
506-
n=OffsetNumberNext(n);
496+
n=OffsetNumberNext(n);
507497
}
508498

509499
MemoryContextSwitchTo(oldcxt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp