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

Commit0a8b9d3

Browse files
committed
Remove no-longer-needed loop in ExecGather().
Coverity complained quite properly that commitea15e18 had introducedunreachable code into ExecGather(); to wit, it was no longer possible toiterate the final for-loop more or less than once. So remove the for().In passing, clean up a couple of comments, and make better use of a localvariable.
1 parent8f164e1 commit0a8b9d3

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

‎src/backend/executor/nodeGather.c

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ ExecGather(GatherState *node)
135135
/*
136136
* Initialize the parallel context and workers on first execution. We do
137137
* this on first execution rather than during node initialization, as it
138-
* needs to allocate large dynamic segment, so it is better to doif it is
139-
* really needed.
138+
* needs to allocatealarge dynamic segment, so it is better to doit
139+
*only if it isreally needed.
140140
*/
141141
if (!node->initialized)
142142
{
@@ -201,32 +201,23 @@ ExecGather(GatherState *node)
201201
* any previous tuple returned by a TupleQueueReader; to make sure we
202202
* don't leave a dangling pointer around, clear the working slot first.
203203
*/
204-
ExecClearTuple(node->funnel_slot);
204+
ExecClearTuple(fslot);
205205
econtext=node->ps.ps_ExprContext;
206206
ResetExprContext(econtext);
207207

208-
/* Get and return the next tuple, projecting if necessary. */
209-
for (;;)
210-
{
211-
/*
212-
* Get next tuple, either from one of our workers, or by running the
213-
* plan ourselves.
214-
*/
215-
slot=gather_getnext(node);
216-
if (TupIsNull(slot))
217-
returnNULL;
218-
219-
/*
220-
* form the result tuple using ExecProject(), and return it --- unless
221-
* the projection produces an empty set, in which case we must loop
222-
* back around for another tuple
223-
*/
224-
econtext->ecxt_outertuple=slot;
225-
226-
returnExecProject(node->ps.ps_ProjInfo);
227-
}
208+
/*
209+
* Get next tuple, either from one of our workers, or by running the plan
210+
* ourselves.
211+
*/
212+
slot=gather_getnext(node);
213+
if (TupIsNull(slot))
214+
returnNULL;
228215

229-
returnslot;
216+
/*
217+
* Form the result tuple using ExecProject(), and return it.
218+
*/
219+
econtext->ecxt_outertuple=slot;
220+
returnExecProject(node->ps.ps_ProjInfo);
230221
}
231222

232223
/* ----------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp