Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> writes: > ! /* no need to allocate more space than we have pages */ > ! maxtuples = LAZY_ALLOC_TUPLES * relblocks; Uh ... you need to guard against integer overflow in this calculation. Perhaps leave the current initialization alone, and then after the Min-reduction steps add /* curious coding to ensure the multiplication can't overflow */ if ((BlockNumber) (maxtuples / LAZY_ALLOC_TUPLES) > relblocks) maxtuples = relblocks * LAZY_ALLOC_TUPLES; which is demonstrably overflow-proof once maxtuples has been clamped to less than INT_MAX. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match