aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-11-03 20:36:32 +0100
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-11-03 20:47:44 +0100
commitb17870d754665c4b431d3ce4de6676832a0b10a0 (patch)
tree48a8f929085b8af05146c80e9bbec5f67367fc98
parent5159626afbe969bdcb6623e9f75f79ecb13ec79c (diff)
downloadpostgresql-b17870d754665c4b431d3ce4de6676832a0b10a0.tar.gz
postgresql-b17870d754665c4b431d3ce4de6676832a0b10a0.zip
Fix thinkos in BRIN summarization
The previous commit contained a thinko that made a single-range summarization request process from there to end of table. Fix by setting the correct end range point. Per buildfarm.
-rw-r--r--src/backend/access/brin/brin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
index 3e2e4ad4e6c..4f0ff79cb49 100644
--- a/src/backend/access/brin/brin.c
+++ b/src/backend/access/brin/brin.c
@@ -1290,8 +1290,11 @@ brinsummarize(Relation index, Relation heapRel, BlockNumber pageRange,
if (pageRange == BRIN_ALL_BLOCKRANGES)
startBlk = 0;
else
+ {
startBlk = (pageRange / pagesPerRange) * pagesPerRange;
- if (startBlk >= heapNumBlocks)
+ heapNumBlocks = Min(heapNumBlocks, startBlk + pagesPerRange);
+ }
+ if (startBlk > heapNumBlocks)
{
/* Nothing to do if start point is beyond end of table */
brinRevmapTerminate(revmap);