Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
1def747d
Commit
1def747d
authored
Dec 24, 2013
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix inadequately-tested code path in tuplesort_skiptuples().
Per report from Jeff Davis.
parent
4eeda92d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
src/backend/utils/sort/tuplesort.c
src/backend/utils/sort/tuplesort.c
+8
-1
No files found.
src/backend/utils/sort/tuplesort.c
View file @
1def747d
...
...
@@ -1725,6 +1725,8 @@ tuplesort_getdatum(Tuplesortstate *state, bool forward,
bool
tuplesort_skiptuples
(
Tuplesortstate
*
state
,
int64
ntuples
,
bool
forward
)
{
MemoryContext
oldcontext
;
/*
* We don't actually support backwards skip yet, because no callers need
* it. The API is designed to allow for that later, though.
...
...
@@ -1760,6 +1762,7 @@ tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples, bool forward)
* We could probably optimize these cases better, but for now it's
* not worth the trouble.
*/
oldcontext
=
MemoryContextSwitchTo
(
state
->
sortcontext
);
while
(
ntuples
--
>
0
)
{
SortTuple
stup
;
...
...
@@ -1767,11 +1770,15 @@ tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples, bool forward)
if
(
!
tuplesort_gettuple_common
(
state
,
forward
,
&
stup
,
&
should_free
))
{
MemoryContextSwitchTo
(
oldcontext
);
return
false
;
if
(
should_free
)
}
if
(
should_free
&&
stup
.
tuple
)
pfree
(
stup
.
tuple
);
CHECK_FOR_INTERRUPTS
();
}
MemoryContextSwitchTo
(
oldcontext
);
return
true
;
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment