New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DECFLOAT should not throw exceptions when +/-NaN, +/-sNaN and +/-Infinity is used in comparisons [CORE5699] #5965
Comments
Modified by: @AlexPeshkoff |
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: @AlexPeshkoff Making it impossible to store special decimal float values in a field does not look like good idea. We can store such values in double field:
======================= (I've used c++ program to add such records to the table - insert with parameter.) SQL> select v, v < 1 from dou;
======================= ======= |
Commented by: @mrotteveel That could also work. As far as I can tell from the SQL standard, technically double precision shouldn't support NaN and infinities either, but as we already do that, we could extend that to DECFLOAT as well. |
Modified by: @AlexPeshkoffsummary: DECFLOAT should disallow +/-NaN, +/-sNaN and +/-Infinity => DECFLOAT should not through exceptions when +/-NaN, +/-sNaN and +/-Infinity is used in comparisons |
Modified by: @mrotteveelsummary: DECFLOAT should not through exceptions when +/-NaN, +/-sNaN and +/-Infinity is used in comparisons => DECFLOAT should not throw exceptions when +/-NaN, +/-sNaN and +/-Infinity is used in comparisons |
Modified by: @AlexPeshkoffFix Version: 4.0 Beta 1 [ 10750 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Covered by another test(s) Test Details: See functional\datatypes\decfloat-nan-and-infinity-comparison.fbt |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Replaces CORE5698
The datatype DECFLOAT currently supports storing +/-NaN, +/-sNaN and +/-Infinity (because the underlying Decimal64 / Decimal128 supports that), this should be disallowed and when attempting to store these values, a "data exception — numeric value out of range" error (or equivalent) should be raised. Storing these values can be achieved by either storing it using parameters, or using conversion from string.
See also SQL:2016, 6.29 <numeric value expression>.
Currently Firebird already disallows overflow to +/- Infinity during calculations with DECFLOAT, nor is it (or should it be possible) to produce NaN during calculation.
Currently, storing +/-NaN or +/-sNaN in a column can lead to problems, for example in a select with a condition involving a decfloat column, having a NaN in that column leads to an error during fetch:
====
*** IBPP::SQLException ***
Context: Statement::Fetch
Message: isc_dsql_fetch failed.
SQL Message : -901
Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements
Engine Code : 335545141
Engine Message :
Decimal float invalid operation. An indeterminant error occurred during an operation.
Commits: d0d92de
====== Test Details ======
See functional\datatypes\decfloat-nan-and-infinity-comparison.fbt
The text was updated successfully, but these errors were encountered: