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:48
Message-ID: E1xRDDc-00000000LXN-14C8@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
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1db7119ac652f1f4bcba0c4b7a3d2fb4a5fa9f60

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 Tom Lane 2026-11-11 22:45:08 pgsql: Fix incorrect early exit from contain_mutable_functions_walker.
Previous Message Masahiko Sawada 2026-11-11 18:38:44 pgsql: Fix the type of heap tuple count passed to parallel vacuum.