postgresql/src
Tomas Vondra c4f64cfab9 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:11 +01:00
..
backend Fix assert in BRIN build_distances 2022-12-30 20:49:11 +01:00
bin Fix some incorrectness in upgrade_adapt.sql on query for WITH OIDS 2022-12-23 11:27:11 +09:00
common Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
fe_utils Use correct connection for cancellation in frontend's parallel slots 2022-08-27 15:22:07 +09:00
include Rethink handling of [Prevent|Is]InTransactionBlock in pipeline mode. 2022-12-13 14:23:59 -05:00
interfaces Fix comment in fe-auth-scram.c 2022-11-30 08:38:27 +09:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Allow building with MSVC and Strawberry perl 2022-11-25 15:37:33 -05:00
port Re-allow building on Microsoft Visual Studio 2013. 2022-11-10 10:23:49 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Fix end LSN determination in recently added test 2022-12-23 17:27:05 +01:00
timezone Update time zone data files to tzdata release 2022f. 2022-11-01 17:08:49 -04:00
tools Fix binary mismatch for MSVC plperl vs gcc built perl libs 2022-11-27 09:18:14 -05:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Prevent port collisions between concurrent TAP tests 2022-11-22 10:51:13 -05:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00