pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix float8_regr_accum() for Inf/NaN with constant other input.
Date
Msg-id E1wuC8c-00000000HwU-0F6i@gemulon.postgresql.org
Whole thread
Responses pgsql: pg_dump: avoid assuming how long pg_proc.protrftypes can be.
List 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@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(+)


Attachment

pgsql-committers by date:

Previous
From: Álvaro Herrera
Date:
Subject: pgsql: Avoid recalculating pgprocno in ProcArrayAdd()
Next
From: Álvaro Herrera
Date:
Subject: pgsql: Reject REPLICA IDENTITY USING INDEX on column with invalid NOT N