Skip to content

Commit fe91ceb

Browse files
committed
Fix old bug in _hash_first() for scan without keys:
if 1st bucket chain is empty then need to continue scan in the rest buckets.
1 parent 3055eef commit fe91ceb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backend/access/hash/hashsearch.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.9 1997/04/30 06:31:16 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -221,7 +221,13 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
221221
} else {
222222
ItemPointerSetInvalid(current);
223223
so->hashso_curbuf = InvalidBuffer;
224-
return ((RetrieveIndexResult) NULL);
224+
/*
225+
* If there is no scankeys, all tuples will satisfy
226+
* the scan - so we continue in _hash_step to get
227+
* tuples from all buckets. - vadim 04/29/97
228+
*/
229+
if ( scan->numberOfKeys >= 1 )
230+
return ((RetrieveIndexResult) NULL);
225231
}
226232
}
227233
if (ScanDirectionIsBackward(dir)) {

0 commit comments

Comments
 (0)