diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2021-04-04 19:36:10 +0200 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2021-04-04 19:36:12 +0200 |
commit | d9c5b9a9eeb9e3061ae139e0e564ce5358c94001 (patch) | |
tree | df0544c154fba0572216f417326459c7d6690c56 | |
parent | 4908684ddab35135869efa2af6b49c4d67c422f9 (diff) | |
download | postgresql-d9c5b9a9eeb9e3061ae139e0e564ce5358c94001.tar.gz postgresql-d9c5b9a9eeb9e3061ae139e0e564ce5358c94001.zip |
Fix bug in brin_minmax_multi_union
When calling sort_expanded_ranges() we need to remember the return
value, because the function sorts and also deduplicates the ranges. So
the number of ranges may decrease. brin_minmax_multi_union failed to do
that, which resulted in crashes due to bogus ranges (equal minval/maxval
but not marked as compacted).
Reported-by: Jaime Casanova
Discussion: https://postgr.es/m/20210404052550.GA4376%40ahch-to
-rw-r--r-- | src/backend/access/brin/brin_minmax_multi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c index 2f4e92695c7..4163abef3f0 100644 --- a/src/backend/access/brin/brin_minmax_multi.c +++ b/src/backend/access/brin/brin_minmax_multi.c @@ -2794,7 +2794,7 @@ brin_minmax_multi_union(PG_FUNCTION_ARGS) BTLessStrategyNumber); /* sort the expanded ranges */ - sort_expanded_ranges(cmpFn, colloid, eranges, neranges); + neranges = sort_expanded_ranges(cmpFn, colloid, eranges, neranges); /* * We've loaded two different lists of expanded ranges, so some of them |