From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix assert in BRIN build_distances |
Date: | 2022-12-30 19:49:42 |
Message-ID: | E1pBLNt-001CEF-MF@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix assert in BRIN build_distances
When brin_minmax_multi_union merges summaries, we may end up with just a
single range after merge_overlapping_ranges. The summaries may contain
just one range each, and they may overlap (or be exactly the same).
With a single range there's no distance to calculate, but we happen to
call build_distances anyway - which is fine, we don't calculate the
distance in this case, except that with asserts this failed due to a
check there are at least two ranges.
The assert is unnecessarily strict, so relax it a bit and bail out if
there's just a single range. The relaxed assert would be enough, but
this way we don't allocate unnecessary memory for distance.
Backpatch to 14, where minmax-multi opclasses were introduced.
Reported-by: Jaime Casanova
Backpatch-through: 14
Discussion: https://postgr.es/m/YzVA55qS0hgz8P3r@ahch-to
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c4f64cfab9fefd7974c9097be72691c33c7afcea
Modified Files
--------------
src/backend/access/brin/brin_minmax_multi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2022-12-30 19:50:12 | pgsql: Fix assert in BRIN build_distances |
Previous Message | Tomas Vondra | 2022-12-30 19:48:19 | pgsql: Fix assert in BRIN build_distances |