From 9a83afecb7ec6e828b7dbef3133f3dd8b0b4dddb Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 29 Apr 2019 14:15:19 -0400 Subject: [PATCH] Widen tuple counter variables from long to int64 Mistake in ab0dfc961b6a; progress reporting would have wrapped around for indexes created with more than 2^31 tuples. Reported-by: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wz=WbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A@mail.gmail.com --- src/backend/access/hash/hashsort.c | 2 +- src/backend/access/nbtree/nbtsort.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/access/hash/hashsort.c b/src/backend/access/hash/hashsort.c index 00a57470a7..293f80fe24 100644 --- a/src/backend/access/hash/hashsort.c +++ b/src/backend/access/hash/hashsort.c @@ -118,7 +118,7 @@ void _h_indexbuild(HSpool *hspool, Relation heapRel) { IndexTuple itup; - long tups_done = 0; + int64 tups_done = 0; #ifdef USE_ASSERT_CHECKING uint32 hashkey = 0; #endif diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 9ac4c1e1c0..e662eee236 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -1130,7 +1130,7 @@ _bt_load(BTWriteState *wstate, BTSpool *btspool, BTSpool *btspool2) int i, keysz = IndexRelationGetNumberOfKeyAttributes(wstate->index); SortSupport sortKeys; - long tuples_done = 0; + int64 tuples_done = 0; if (merge) { -- 2.40.0