Skip to content
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

Closed
firebird-issue-importer opened this issue Jan 27, 2018 · 8 comments

Comments

@firebird-issue-importer

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 27, 2018

Modified by: @mrotteveel

description: 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). 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 (
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). 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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 27, 2018

Modified by: @mrotteveel

description: 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). 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 (
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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 29, 2018

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2018

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2018

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 15, 2018

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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 17, 2018

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 17, 2018

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants