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

Commit25dc142

Browse files
committed
Avoid GatherMerge crash when there are no workers.
It's unnecessary to return an actual slot when we have no tuple.We can just return NULL, which avoids the risk of indexing into anarray that might not contain any elements.Rushabh Lathia, per a report from Tomas VondraDiscussion:http://postgr.es/m/6ecd6f17-0dcf-1de7-ded8-0de7db1ddc88@2ndquadrant.com
1 parent7d8f698 commit25dc142

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

‎src/backend/executor/nodeGatherMerge.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ gather_merge_init(GatherMergeState *gm_state)
419419
}
420420

421421
/*
422-
* Clear out the tuple table slots for each gather merge input,
423-
* and return a cleared slot.
422+
* Clear out the tuple table slots for each gather merge input.
424423
*/
425-
staticTupleTableSlot*
424+
staticvoid
426425
gather_merge_clear_slots(GatherMergeState*gm_state)
427426
{
428427
inti;
@@ -437,9 +436,6 @@ gather_merge_clear_slots(GatherMergeState *gm_state)
437436
pfree(gm_state->gm_tuple_buffers);
438437
/* Free the binaryheap, which was created for sort */
439438
binaryheap_free(gm_state->gm_heap);
440-
441-
/* return any clear slot */
442-
returngm_state->gm_slots[0];
443439
}
444440

445441
/*
@@ -479,7 +475,8 @@ gather_merge_getnext(GatherMergeState *gm_state)
479475
if (binaryheap_empty(gm_state->gm_heap))
480476
{
481477
/* All the queues are exhausted, and so is the heap */
482-
returngather_merge_clear_slots(gm_state);
478+
gather_merge_clear_slots(gm_state);
479+
returnNULL;
483480
}
484481
else
485482
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp