-
- Downloads
Implement width_bucket() for the float8 data type.
The implementation is somewhat ugly logic-wise, but I don't see an easy way to make it more concise. When writing this, I noticed that my previous implementation of width_bucket() doesn't handle NaN correctly: postgres=# select width_bucket('NaN', 1, 5, 5); width_bucket -------------- 6 (1 row) AFAICS SQL:2003 does not define a NaN value, so it doesn't address how width_bucket() should behave here. The patch changes width_bucket() so that ereport(ERROR) is raised if NaN is specified for the operand or the lower or upper bounds to width_bucket(). For float8, NaN is disallowed for any of the floating-point inputs, and +/- infinity is disallowed for the histogram bounds (but allowed for the operand). Update docs and regression tests, bump the catversion.
Showing
- doc/src/sgml/func.sgml 11 additions, 1 deletiondoc/src/sgml/func.sgml
- src/backend/utils/adt/float.c 83 additions, 1 deletionsrc/backend/utils/adt/float.c
- src/backend/utils/adt/numeric.c 13 additions, 6 deletionssrc/backend/utils/adt/numeric.c
- src/include/catalog/catversion.h 2 additions, 2 deletionssrc/include/catalog/catversion.h
- src/include/catalog/pg_proc.h 3 additions, 1 deletionsrc/include/catalog/pg_proc.h
- src/include/utils/builtins.h 2 additions, 1 deletionsrc/include/utils/builtins.h
- src/test/regress/expected/numeric.out 63 additions, 41 deletionssrc/test/regress/expected/numeric.out
- src/test/regress/sql/numeric.sql 33 additions, 16 deletionssrc/test/regress/sql/numeric.sql
Loading
Please register or sign in to comment