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 <[email protected]>
Author: Andrey Rachitskiy <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
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(+)

Reply via email to