Skip to content

Commit 0d68ad3

Browse files
committed
Fix division by zero in _bt_vacuum_needs_cleanup()
Checks inside _bt_vacuum_needs_cleanup() allow division by zero to happen when metad->btm_last_cleanup_num_heap_tuples == 0. This commit adjusts the expression so that no division by zero might happen. Reported-by: Piotr Stefaniak Discussion: https://postgr.es/m/DB8PR03MB5931C41F7787A95313F08322F22A0%40DB8PR03MB5931.eurprd03.prod.outlook.com Reviewed-by: Masahiko Sawada Backpatch-through: 11
1 parent 5129026 commit 0d68ad3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/nbtree/nbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
833833
prev_num_heap_tuples = metad->btm_last_cleanup_num_heap_tuples;
834834

835835
if (cleanup_scale_factor <= 0 ||
836-
prev_num_heap_tuples < 0 ||
836+
prev_num_heap_tuples <= 0 ||
837837
(info->num_heap_tuples - prev_num_heap_tuples) /
838838
prev_num_heap_tuples >= cleanup_scale_factor)
839839
result = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy