Fix overflow of nbatch

Vaibhav Jain <jainva@google.com>

From: Vaibhav Jain <jainva@google.com>
To: pgsql-hackers@postgresql.org
Cc: Madhukar <madhukarprasad@google.com>, Sangeetha Seshadri <sangsesh@google.com>
Date: 2025-09-22T13:20:51Z
Lists: pgsql-hackers

Attachments

Hi Everyone,

With a1b4f28, to compute current_space, nbatch is being multiplied
by BLCKSZ. nbatch is int and when multiplied with BLCKSZ, it can
easily overflow the int limit.To keep the calculation safe for
current_space, convert nbatch to size_t.

Please find a patch for the same.

Thanks,
Vaibhav

Commits

  1. Fix hashjoin memory balancing logic