postgresql/src
Tom Lane 0b0d3c19bf Fix incorrect return value in brin_minmax_multi_distance_numeric().
The result of "DirectFunctionCall1(numeric_float8, d)" is already in
Datum form, but the code was incorrectly applying PG_RETURN_FLOAT8()
to it.  On machines where float8 is pass-by-reference, this would
result in complete garbage, since an unpredictable pointer value
would be treated as an integer and then converted to float.  It's not
entirely clear how much of a problem would ensue on 64-bit hardware,
but certainly interpreting a float8 bitpattern as uint64 and then
converting that to float isn't the intended behavior.

As luck would have it, even the complete-garbage case doesn't break
BRIN indexes, since the results are only used to make choices about
how to merge values into ranges: at worst, we'd make poor choices
resulting in an inefficient index.  Doubtless that explains the lack
of field complaints.  However, users with BRIN indexes that use the
numeric_minmax_multi_ops opclass may wish to reindex in hopes of
making their indexes more efficient.

Author: Peter Eisentraut <peter@eisentraut.org>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2093712.1753983215@sss.pgh.pa.us
Backpatch-through: 14
2025-08-05 16:51:10 -04:00
..
backend Fix incorrect return value in brin_minmax_multi_distance_numeric(). 2025-08-05 16:51:10 -04:00
bin Fix assertion failure in pgbench when handling multiple pipeline sync messages. 2025-08-03 10:50:01 +09:00
common With GB18030, prevent SIGSEGV from reading past end of allocation. 2025-05-05 04:52:07 -07:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Fix a deadlock during ALTER SUBSCRIPTION ... DROP PUBLICATION. 2025-08-01 06:53:16 +00:00
interfaces Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
port Make our usage of memset_s() conform strictly to the C11 standard. 2025-05-18 12:45:55 -04:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Minor test fixes in 035_standby_logical_decoding.pl 2025-08-04 15:07:08 -04:00
timezone Update time zone data files to tzdata release 2025b. 2025-04-30 11:14:01 -04:00
tools meson: Flush stdout in testwrap 2025-03-19 09:04:09 -04:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00