Skip to content

Commit 34df02d

Browse files
akorotkovAlexander Korotkov
authored andcommitted
Fix number of copying history items.
1 parent e1013f9 commit 34df02d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/pg_stat_wait/collector.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ ReallocHistory(History *observations, int count)
148148
newitems = (HistoryItem *) palloc0(sizeof(HistoryItem) * count);
149149

150150
if (observations->wraparound)
151-
copyCount = Min(observations->count, count);
151+
copyCount = observations->count;
152152
else
153153
copyCount = observations->index;
154154

155+
copyCount = Min(copyCount, count);
156+
155157
i = 0;
156158
j = observations->index;
157159
while (i < copyCount)

0 commit comments

Comments
 (0)