agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
@ 2026-08-12 16:49  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-08-12 16:49 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.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(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
@ 2026-08-12 16:49  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-08-12 16:49 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19615-c7e390593416f6b6@postgresql.org
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/94f94b245c6598f3a2b1d5ee3c463719ea83c869

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(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-08-12 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12 16:49 pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input. Tom Lane <tgl@sss.pgh.pa.us>
2026-08-12 16:49 pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox