You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Make the overflow guards in ExecChooseHashTableSize be more protective.
The original coding ensured nbuckets and nbatch didn't exceed INT_MAX,which while not insane on its own terms did nothing to protect subsequentcode like "palloc(nbatch * sizeof(BufFile *))". Since enormous join sizeestimates might well be planner error rather than reality, it seems bestto constrain the initial sizes to be not more than work_mem/sizeof(pointer),thus ensuring the allocated arrays don't exceed work_mem. We will allownbatch to get bigger than that during subsequent ExecHashIncreaseNumBatchescalls, but we should still guard against integer overflow in those pallocrequests. Per bug #5145 from Bernt Marius Johnsen.Although the given test case only seems to fail back to 8.2, previousreleases have variants of this issue, so patch all supported branches.