Fix the check of BufFileRead() in ExecHashJoinGetSavedTuple()
The API it used was ExecWorkFile_Read() but not BufFileRead() at the
beginning, but the returnning check was not updated with the API
changes.
@@ -1592,12 +1592,15 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
* cheating.
*/
nread = BufFileRead(file, (void *) header, sizeof(header));
- if (nread != sizeof(header)) /* end of file */
+ if (nread == 0) /* end of file */
{
ExecClearTuple(tupleSlot);
return NULL;
}
-
+ if (nread != sizeof(header))
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("could not read from hash-join temporary file: %m")));
*hashvalue = header[0];
tuple = (MinimalTuple) palloc(header[1]);
tuple->t_len = header[1];
