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
Unclear error message when inserting value exceeding max of dec_fixed decimal [CORE5726] #5992
Comments
Modified by: @mrotteveeldescription: Inserting a value that exceeds the precision of a dec_fixed decimal column results in an unclear exception message. Table: create table extdecimal ( Insert: insert into extdecimal(dec34_34) values (1); This yields error: SQL Message : -901 Engine Code : 335545141 Instead it should raise error 335544321 (arithmetic exception, numeric overflow, or string truncation) + error 335544916 (numeric value is out of range), as 1 doesn't fit in a decimal(34, 34). With the previous maximum of precision 18, a decimal(18,18) would accept 1-9 (as is actually precision 19 with some caveats), but raise 335544321 + 335544916 when inserting 10 or higher. => Inserting a value that exceeds the precision of a dec_fixed decimal column results in an unclear exception message. Table: create table extdecimal ( Insert: insert into extdecimal(dec34_34) values (1); This yields error: SQL Message : -901 Engine Code : 335545141 Instead it should raise error 335544321 (arithmetic exception, numeric overflow, or string truncation) + error 335544916 (numeric value is out of range), as 1 doesn't fit in a decimal(34, 34). With the previous maximum of precision 18, a decimal(18,18) would accept 1-9 (as it is actually precision 19 with some caveats), but raise 335544321 + 335544916 when inserting 10 or higher. |
Modified by: @mrotteveeldescription: Inserting a value that exceeds the precision of a dec_fixed decimal column results in an unclear exception message. Table: create table extdecimal ( Insert: insert into extdecimal(dec34_34) values (1); This yields error: SQL Message : -901 Engine Code : 335545141 Instead it should raise error 335544321 (arithmetic exception, numeric overflow, or string truncation) + error 335544916 (numeric value is out of range), as 1 doesn't fit in a decimal(34, 34). With the previous maximum of precision 18, a decimal(18,18) would accept 1-9 (as it is actually precision 19 with some caveats), but raise 335544321 + 335544916 when inserting 10 or higher. => Inserting a value that exceeds the precision of a dec_fixed decimal column results in an unclear exception message. Table: create table extdecimal ( Insert: insert into extdecimal(dec34_34) values (1); This yields error: SQL Message : -901 Engine Code : 335545141 Instead it should raise error 335544321 (arithmetic exception, numeric overflow, or string truncation) + error 335544916 (numeric value is out of range), as 1 doesn't fit in a decimal(34, 34). For comparison, a decimal(18,18) will accept 1-9 (as it is actually precision 19 with some caveats), but raise 335544321 + 335544916 when inserting 10 or higher. |
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: @AlexPeshkoff It was decided not to use 335544321 for decimal float values. Therefore I just extend existing library error (more or less standard) with 335544916 |
Modified by: @AlexPeshkoffstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 Beta 1 [ 10750 ] |
Commented by: @mrotteveel Who and where was that decided, and what is the rationale for that decision? Using the same error codes for these errors will allow common handling of errors irrespective of datatype. This decision now means that a similar problem with decimal(18,18) will produce a different error than for decimal(34,34), that is inconsistent, especially as for the outside observer these are the same datatypes. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Done successfully |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Inserting a value that exceeds the precision of a dec_fixed decimal column results in an unclear exception message.
Table:
create table extdecimal (
id integer generated always as identity primary key,
dec34_34 decimal(34, 34)
);
Insert:
insert into extdecimal(dec34_34) values (1);
This yields error:
Error: *** IBPP::SQLException ***
Context: Statement::Execute( insert into extdecimal(dec34_34) values (1) )
Message: isc_dsql_execute2 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.
Instead it should raise error 335544321 (arithmetic exception, numeric overflow, or string truncation) + error 335544916 (numeric value is out of range), as 1 doesn't fit in a decimal(34, 34). For comparison, a decimal(18,18) will accept 1-9 (as it is actually precision 19 with some caveats), but raise 335544321 + 335544916 when inserting 10 or higher.
Commits: 3baa89f
The text was updated successfully, but these errors were encountered: