postgresql/src
Tom Lane 80c758a2e1 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 Hide expensive pg_upgrade test behind PG_TEST_EXTRA 2025-08-05 20:09:42 +02:00
common Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:40 -04:00
fe_utils Fix bug in archive streamer with LZ4 decompression 2025-07-02 13:48:36 +09:00
include Add backup_type column to pg_stat_progress_basebackup. 2025-08-05 10:50:45 -07:00
interfaces libpq: Complain about missing BackendKeyData later with PGgetCancel() 2025-08-01 18:24:19 +03:00
makefiles meson: Increase minimum version to 0.57.2 2025-07-02 11:14:53 +02:00
pl Reduce leakage during PL/pgSQL function compilation. 2025-08-02 21:59:46 -04:00
port Use strchr instead of strstr for single-char lookups 2025-07-23 12:02:55 +12:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Add backup_type column to pg_stat_progress_basebackup. 2025-08-05 10:50:45 -07:00
timezone Update time zone data files to tzdata release 2025b. 2025-04-30 11:13:49 -04:00
tools Suppress complaints about leaks in TS dictionary loading. 2025-08-02 21:59:46 -04:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -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:40 -04:00
Makefile.shlib Use exported symbols list on macOS for loadable modules as well 2025-06-10 07:04:43 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00