The following SQL query:
SELECT ROUND('NaN'::double)
results in:
ROUND('NaN'::double)
--------------------
-0.0
Other major relational DBs behave differently.
MySQL and MSSQL does not have NaN (only NULL ), ROUND(NULL) is NULL.
PostgreSQL and Oracle has NaN and ROUND(NaN) returns NaN.
Was it intentional that we kept this in-sync with the Math.round() behaviour and different from the relational DBs above?
Note: H2 (that we check against in integration tests) also follows the behaviour of Math.round().
The following SQL query:
results in:
Other major relational DBs behave differently.
MySQL and MSSQL does not have
NaN(onlyNULL),ROUND(NULL)isNULL.PostgreSQL and Oracle has
NaNandROUND(NaN)returnsNaN.Was it intentional that we kept this in-sync with the
Math.round()behaviour and different from the relational DBs above?Note: H2 (that we check against in integration tests) also follows the behaviour of
Math.round().