agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
Date: Wed, 12 Aug 2026 16:49:11 +0000
Message-ID: <E1wuC8c-00000000HwW-0Jtu@gemulon.postgresql.org> (raw)

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



view thread (2+ messages)

Message-ID: <E1wuC8c-00000000HwW-0Jtu@gemulon.postgresql.org>
Permalink:  ../E1wuC8c-00000000HwW-0Jtu@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wuC8c-00000000HwW-0Jtu@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
  In-Reply-To: <E1wuC8c-00000000HwW-0Jtu@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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