| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input. |
| Date: | 2026-08-12 16:49:11 |
| Message-ID: | E1wuC8c-00000000HwU-0F6i@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix float8_regr_accum() for Inf/NaN with constant other input.
Commit 649828769 improved this code to keep Sxx, Syy, and Sxy
exactly zero so long as we see only a single value of the input(s).
However, if any values of the other input are Inf or NaN, we'd
better set Sxy to NaN instead. Otherwise we risk reporting zero
variance when the result is really undefined. The old coding handled
this implicitly, but in the short-circuit path we have to take care
of it explicitly.
Bug: #19615
Reported-by: Junwen An <feasiblechart(at)gmail(dot)com>
Author: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19615-c7e390593416f6b6@postgresql.org
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7774249d0b66fff0b60823783db24090981020ac
Modified Files
--------------
src/backend/utils/adt/float.c | 11 ++++++++++
src/test/regress/expected/aggregates.out | 36 ++++++++++++++++++++++++++++++++
src/test/regress/sql/aggregates.sql | 12 +++++++++++
3 files changed, 59 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-08-12 17:17:45 | pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N |
| Previous Message | Tom Lane | 2026-08-12 15:55:59 | Re: pgsql: Change wal_compression=on to the first of zstd, lz4, pglz |