Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
3afffbc9
Commit
3afffbc9
authored
16 years ago
by
Teodor Sigaev
Browse files
Options
Downloads
Patches
Plain Diff
Remove support of backward scan in GiST. Per discussion
http://archives.postgresql.org/pgsql-hackers/2008-10/msg00857.php
parent
a6ebb1f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/access/gist/gistget.c
+15
-25
15 additions, 25 deletions
src/backend/access/gist/gistget.c
with
15 additions
and
25 deletions
src/backend/access/gist/gistget.c
+
15
−
25
View file @
3afffbc9
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.7
7
2008/10/20 1
3
:3
9:4
4 teodor Exp $
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.7
8
2008/10/20 1
6
:3
5:1
4 teodor Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -23,9 +23,8 @@
...
@@ -23,9 +23,8 @@
#include
"utils/memutils.h"
#include
"utils/memutils.h"
static
OffsetNumber
gistfindnext
(
IndexScanDesc
scan
,
OffsetNumber
n
,
static
OffsetNumber
gistfindnext
(
IndexScanDesc
scan
,
OffsetNumber
n
);
ScanDirection
dir
);
static
int64
gistnext
(
IndexScanDesc
scan
,
TIDBitmap
*
tbm
);
static
int64
gistnext
(
IndexScanDesc
scan
,
ScanDirection
dir
,
TIDBitmap
*
tbm
);
static
bool
gistindex_keytest
(
IndexTuple
tuple
,
IndexScanDesc
scan
,
static
bool
gistindex_keytest
(
IndexTuple
tuple
,
IndexScanDesc
scan
,
OffsetNumber
offset
);
OffsetNumber
offset
);
...
@@ -80,6 +79,9 @@ gistgettuple(PG_FUNCTION_ARGS)
...
@@ -80,6 +79,9 @@ gistgettuple(PG_FUNCTION_ARGS)
so
=
(
GISTScanOpaque
)
scan
->
opaque
;
so
=
(
GISTScanOpaque
)
scan
->
opaque
;
if
(
dir
!=
ForwardScanDirection
)
elog
(
ERROR
,
"GiST doesn't support other scan directions than forward"
);
/*
/*
* If we have produced an index tuple in the past and the executor has
* If we have produced an index tuple in the past and the executor has
* informed us we need to mark it as "killed", do so now.
* informed us we need to mark it as "killed", do so now.
...
@@ -90,7 +92,7 @@ gistgettuple(PG_FUNCTION_ARGS)
...
@@ -90,7 +92,7 @@ gistgettuple(PG_FUNCTION_ARGS)
/*
/*
* Get the next tuple that matches the search key.
* Get the next tuple that matches the search key.
*/
*/
res
=
(
gistnext
(
scan
,
dir
,
NULL
)
>
0
);
res
=
(
gistnext
(
scan
,
NULL
)
>
0
);
PG_RETURN_BOOL
(
res
);
PG_RETURN_BOOL
(
res
);
}
}
...
@@ -102,7 +104,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
...
@@ -102,7 +104,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
TIDBitmap
*
tbm
=
(
TIDBitmap
*
)
PG_GETARG_POINTER
(
1
);
TIDBitmap
*
tbm
=
(
TIDBitmap
*
)
PG_GETARG_POINTER
(
1
);
int64
ntids
;
int64
ntids
;
ntids
=
gistnext
(
scan
,
ForwardScanDirection
,
tbm
);
ntids
=
gistnext
(
scan
,
tbm
);
PG_RETURN_INT64
(
ntids
);
PG_RETURN_INT64
(
ntids
);
}
}
...
@@ -122,7 +124,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
...
@@ -122,7 +124,7 @@ gistgetbitmap(PG_FUNCTION_ARGS)
* non-killed tuple that matches the search key.
* non-killed tuple that matches the search key.
*/
*/
static
int64
static
int64
gistnext
(
IndexScanDesc
scan
,
ScanDirection
dir
,
TIDBitmap
*
tbm
)
gistnext
(
IndexScanDesc
scan
,
TIDBitmap
*
tbm
)
{
{
Page
p
;
Page
p
;
OffsetNumber
n
;
OffsetNumber
n
;
...
@@ -169,9 +171,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
...
@@ -169,9 +171,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
if
(
so
->
curPageData
<
so
->
nPageData
)
if
(
so
->
curPageData
<
so
->
nPageData
)
{
{
/*
* pageData is already ordered for scan's direction
*/
scan
->
xs_ctup
.
t_self
=
so
->
pageData
[
so
->
curPageData
].
iptr
;
scan
->
xs_ctup
.
t_self
=
so
->
pageData
[
so
->
curPageData
].
iptr
;
scan
->
xs_recheck
=
so
->
pageData
[
so
->
curPageData
].
recheck
;
scan
->
xs_recheck
=
so
->
pageData
[
so
->
curPageData
].
recheck
;
so
->
curPageData
++
;
so
->
curPageData
++
;
...
@@ -252,9 +251,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
...
@@ -252,9 +251,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
continue
;
continue
;
}
}
if
(
ScanDirectionIsBackward
(
dir
))
n
=
PageGetMaxOffsetNumber
(
p
);
else
n
=
FirstOffsetNumber
;
n
=
FirstOffsetNumber
;
/* wonderful, we can look at page */
/* wonderful, we can look at page */
...
@@ -262,7 +258,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
...
@@ -262,7 +258,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
for
(;;)
for
(;;)
{
{
n
=
gistfindnext
(
scan
,
n
,
dir
);
n
=
gistfindnext
(
scan
,
n
);
if
(
!
OffsetNumberIsValid
(
n
))
if
(
!
OffsetNumberIsValid
(
n
))
{
{
...
@@ -275,7 +271,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
...
@@ -275,7 +271,7 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
if
(
!
tbm
&&
so
->
nPageData
>
0
)
if
(
!
tbm
&&
so
->
nPageData
>
0
)
{
{
LockBuffer
(
so
->
curbuf
,
GIST_UNLOCK
);
LockBuffer
(
so
->
curbuf
,
GIST_UNLOCK
);
return
gistnext
(
scan
,
dir
,
NULL
);
return
gistnext
(
scan
,
NULL
);
}
}
/*
/*
...
@@ -346,9 +342,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
...
@@ -346,9 +342,6 @@ gistnext(IndexScanDesc scan, ScanDirection dir, TIDBitmap *tbm)
so
->
stack
->
next
=
stk
;
so
->
stack
->
next
=
stk
;
}
}
if
(
ScanDirectionIsBackward
(
dir
))
n
=
OffsetNumberPrev
(
n
);
else
n
=
OffsetNumberNext
(
n
);
n
=
OffsetNumberNext
(
n
);
}
}
}
}
...
@@ -475,7 +468,7 @@ gistindex_keytest(IndexTuple tuple,
...
@@ -475,7 +468,7 @@ gistindex_keytest(IndexTuple tuple,
* Page should be locked....
* Page should be locked....
*/
*/
static
OffsetNumber
static
OffsetNumber
gistfindnext
(
IndexScanDesc
scan
,
OffsetNumber
n
,
ScanDirection
dir
)
gistfindnext
(
IndexScanDesc
scan
,
OffsetNumber
n
)
{
{
OffsetNumber
maxoff
;
OffsetNumber
maxoff
;
IndexTuple
it
;
IndexTuple
it
;
...
@@ -500,9 +493,6 @@ gistfindnext(IndexScanDesc scan, OffsetNumber n, ScanDirection dir)
...
@@ -500,9 +493,6 @@ gistfindnext(IndexScanDesc scan, OffsetNumber n, ScanDirection dir)
if
(
gistindex_keytest
(
it
,
scan
,
n
))
if
(
gistindex_keytest
(
it
,
scan
,
n
))
break
;
break
;
if
(
ScanDirectionIsBackward
(
dir
))
n
=
OffsetNumberPrev
(
n
);
else
n
=
OffsetNumberNext
(
n
);
n
=
OffsetNumberNext
(
n
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment