git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 03109a5) | patch
Sync behavior of var_samp and stddev_samp for single NaN inputs.
2020年6月13日 18:01:46 +0000 (14:01 -0400)
2020年6月13日 18:01:46 +0000 (14:01 -0400)
commit 23cbeda50b94c817bed4f7d2127ee09c4e8c8b86
Sync behavior of var_samp and stddev_samp for single NaN inputs.

var_samp(numeric) and stddev_samp(numeric) disagreed with their float
cousins about what to do for a single non-null input value that is NaN.
The float versions return NULL on the grounds that the calculation is
only defined for more than one non-null input, which seems like the
right answer. But the numeric versions returned NaN, as a result of
dealing with edge cases in the wrong order. Fix that. The patch
also gets rid of an insignificant memory leak in such cases.

This inconsistency is of long standing, but on the whole it seems best
not to back-patch the change into stable branches; nobody's complained
and it's such an obscure point that nobody's likely to complain.
(Note that v13 and v12 now contain test cases that will notice if we
accidentally back-patch this behavior change in future.)

Report and patch by me; thanks to Dean Rasheed for review.

Discussion: https://postgr.es/m/353062.1591898766@sss.pgh.pa.us
src/backend/utils/adt/numeric.c diff | blob | blame | history
src/test/regress/expected/aggregates.out diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /