pgsql: Fix the type of heap tuple count passed to parallel vacuum.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix the type of heap tuple count passed to parallel vacuum.
Date: 2026-11-11 18:38:44
Message-ID: E1xRDDY-00000000LWj-14qv@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix the type of heap tuple count passed to parallel vacuum.

Commit 8e1fae19386 declared the heap tuple count passed to parallel
index bulk-deletion and cleanup as long, although the callers pass a
double and it's stored as a double for the index AMs. On platforms
where long is 32 bits, such as Windows, a count above LONG_MAX doesn't
fit, so the index AMs could get a bogus num_heap_tuples when vacuuming
in parallel. In the cleanup phase, this could lead to wrong index
statistics.

Fix by declaring it as double.

The bug exists since v15, but changing the function signatures would
break ABI in released branches, so backpatch to v19 only.

Author: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/CA+fm-ROT7pH2oBrp=hOJfh8ux+UO0Y0vRk7xD_wcdRVVqWrs+g@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8d87367b39e44b0913ca585c733795cc2d30bff1

Modified Files
--------------
src/backend/commands/vacuumparallel.c | 4 ++--
src/include/commands/vacuum.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2026-11-11 18:38:48 pgsql: Fix the type of heap tuple count passed to parallel vacuum.
Previous Message Tomas Vondra 2026-11-11 17:49:14 pgsql: Reject join input paths parameterized by pushed-down outer joins