mirror of
https://github.com/postgres/postgres.git
synced 2025-06-05 23:56:58 +03:00
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 where there were no inner tuples at all. Thanks to Xiaoyu Wang for finding a test case that exposed this long-standing bug.
This commit is contained in:
parent
1cfe0a407d
commit
c57bcb7b2c
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.41 2002/09/02 02:47:02 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.41.2.1 2004/09/17 18:29:24 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -568,12 +568,14 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can skip over any batches that are empty on either side. Release
|
* Normally we can skip over any batches that are empty on either side
|
||||||
* associated temp files right away.
|
* --- but for JOIN_LEFT, can only skip when left side is empty.
|
||||||
|
* Release associated temp files right away.
|
||||||
*/
|
*/
|
||||||
while (newbatch <= nbatch &&
|
while (newbatch <= nbatch &&
|
||||||
(innerBatchSize[newbatch - 1] == 0L ||
|
(outerBatchSize[newbatch - 1] == 0L ||
|
||||||
outerBatchSize[newbatch - 1] == 0L))
|
(innerBatchSize[newbatch - 1] == 0L &&
|
||||||
|
hjstate->js.jointype != JOIN_LEFT)))
|
||||||
{
|
{
|
||||||
BufFileClose(hashtable->innerBatchFile[newbatch - 1]);
|
BufFileClose(hashtable->innerBatchFile[newbatch - 1]);
|
||||||
hashtable->innerBatchFile[newbatch - 1] = NULL;
|
hashtable->innerBatchFile[newbatch - 1] = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user