postgresql/src/backend/access
Tomas Vondra 02699bc1fd 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
2022-12-30 20:49:50 +01:00
..
brin Fix assert in BRIN build_distances 2022-12-30 20:49:50 +01:00
common Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
gin Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
gist Add const to BufFileWrite 2022-12-30 10:12:24 +01:00
hash Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
heap Add page-level freezing to VACUUM. 2022-12-28 08:50:47 -08:00
index Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
nbtree Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
rmgrdesc Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
spgist Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
table Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
tablesample Add copyright notices to meson files 2022-12-20 07:54:39 -05:00
transam Rename pg_dissect_walfile_name() to pg_split_walfile_name() 2022-12-23 09:15:01 +09:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00
meson.build Add copyright notices to meson files 2022-12-20 07:54:39 -05:00