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

Commitf4d5c52

Browse files
committed
Hashed LEFT JOIN would miss outer tuples with no inner match if the join
was large enough to be batched and the tuples fell into a batch wherethere were no inner tuples at all. Thanks to Xiaoyu Wang for finding atest case that exposed this long-standing bug.
1 parent3c06653 commitf4d5c52

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎src/backend/executor/nodeHashjoin.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.38 2001/03/22 06:16:13 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.38.2.1 2004/09/17 18:29:54 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -575,12 +575,14 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
575575
}
576576

577577
/*
578-
* We can skip over any batches that are empty on either side. Release
579-
* associated temp files right away.
578+
* Normally we can skip over any batches that are empty on either side
579+
* --- but for JOIN_LEFT, can only skip when left side is empty.
580+
* Release associated temp files right away.
580581
*/
581582
while (newbatch <=nbatch&&
582-
(innerBatchSize[newbatch-1]==0L||
583-
outerBatchSize[newbatch-1]==0L))
583+
(outerBatchSize[newbatch-1]==0L||
584+
(innerBatchSize[newbatch-1]==0L&&
585+
hjstate->js.jointype!=JOIN_LEFT)))
584586
{
585587
BufFileClose(hashtable->innerBatchFile[newbatch-1]);
586588
hashtable->innerBatchFile[newbatch-1]=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp