forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit23cbeda
committed
Sync behavior of var_samp and stddev_samp for single NaN inputs.
var_samp(numeric) and stddev_samp(numeric) disagreed with their floatcousins 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 isonly defined for more than one non-null input, which seems like theright answer. But the numeric versions returned NaN, as a result ofdealing with edge cases in the wrong order. Fix that. The patchalso gets rid of an insignificant memory leak in such cases.This inconsistency is of long standing, but on the whole it seems bestnot to back-patch the change into stable branches; nobody's complainedand 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 weaccidentally 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.us1 parent03109a5 commit23cbeda
File tree
2 files changed
+19
-20
lines changed- src
- backend/utils/adt
- test/regress/expected
2 files changed
+19
-20
lines changedLines changed: 17 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5172 | 5172 |
| |
5173 | 5173 |
| |
5174 | 5174 |
| |
5175 |
| - | |
| 5175 | + | |
5176 | 5176 |
| |
5177 | 5177 |
| |
5178 |
| - | |
5179 |
| - | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
5180 | 5190 |
| |
5181 | 5191 |
| |
5182 | 5192 |
| |
5183 | 5193 |
| |
5184 | 5194 |
| |
5185 | 5195 |
| |
5186 | 5196 |
| |
| 5197 | + | |
| 5198 | + | |
| 5199 | + | |
5187 | 5200 |
| |
5188 | 5201 |
| |
5189 | 5202 |
| |
| 5203 | + | |
5190 | 5204 |
| |
5191 | 5205 |
| |
5192 | 5206 |
| |
| |||
5195 | 5209 |
| |
5196 | 5210 |
| |
5197 | 5211 |
| |
5198 |
| - | |
5199 |
| - | |
5200 |
| - | |
5201 |
| - | |
5202 |
| - | |
5203 |
| - | |
5204 |
| - | |
5205 |
| - | |
5206 |
| - | |
5207 |
| - | |
5208 |
| - | |
5209 |
| - | |
5210 |
| - | |
5211 |
| - | |
5212 |
| - | |
5213 | 5212 |
| |
5214 | 5213 |
| |
5215 | 5214 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
217 |
| - | |
| 217 | + | |
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
222 | 222 |
| |
223 |
| - | |
| 223 | + | |
224 | 224 |
| |
225 | 225 |
| |
226 | 226 |
| |
|
0 commit comments
Comments
(0)