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

Statement "CREATE DOMAIN [dm_name] as BIGINT" raises "numeric value is out of range" if its default value is -9223372036854775808 [CORE6291] #6533

Closed
firebird-automations opened this issue Apr 25, 2020 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Duplicates CORE6294

Run this script:

create domain dm_bigint_absolute_max as bigint default 9223372036854775807;
create domain dm_bigint_near_abs_min as bigint default -9223372036854775807;
create domain dm_bigint_absolute_min as bigint default -9223372036854775808;

Its last statement will raise:

Statement failed, SQLSTATE = 22003
unsuccessful metadata update
-CREATE DOMAIN DM_BIGINT_ABSOLUTE_MIN failed
-Dynamic SQL Error
-SQL error code = -104
-arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

Only 4.x is affected (I've checked several 64-bit snapshots, since 4.0.0.840 and up to current 4.0.0.1935; result is the same on Windows and Linux).

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Perhaps, this problem relates not only domain definition:

SQL> recreate table test(n bigint default -9223372036854775807);
SQL> alter table test add n2 bigint default -9223372036854775808;
Statement failed, SQLSTATE = 22003
unsuccessful metadata update
-ALTER TABLE TEST failed
-Dynamic SQL Error
-SQL error code = -104
-arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>

As temp. workaround one may use hex literal 0x8000000000000000 which equal to min_bigint:

SQL> set heading off;
SQL> recreate table test(n bigint default 0x8000000000000000);
SQL> insert into test default values;
SQL> select * from test;

-9223372036854775808

SQL> create domain dm_test bigint default 0x8000000000000000;
SQL> create table test2( d dm_test );
SQL> insert into test2 default values;
SQL> select * from test2;

-9223372036854775808

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Link: This issue duplicates CORE6294 [ CORE6294 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 RC 1 [ 10930 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Some examples still fail. Checked on WI-T4.0.0.1954 Firebird 4.0 Beta 2:

create domain dom06_13 as numeric(20,2) default -9999999999999999991; -- this is from CORE6294; it failed before, now it runs OK

create domain dm_bigint_absolute_max as bigint default 9223372036854775807;

create domain dm_bigint_near_abs_min as bigint default -9223372036854775807;

create domain dm_bigint_absolute_min as bigint default -9223372036854775808;
Statement failed, SQLSTATE = 22003
unsuccessful metadata update
-CREATE DOMAIN DM_BIGINT_ABSOLUTE_MIN failed
-Dynamic SQL Error
-SQL error code = -104
-arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

create table test1(n bigint default -9223372036854775808);
Statement failed, SQLSTATE = 22003
unsuccessful metadata update
-CREATE TABLE TEST1 failed
-Dynamic SQL Error
-SQL error code = -104
-arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Deferred

Test Details: Problem not yet resolved. See note 05/May/20 05:49 AM (here).

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 4.0 RC 1 [ 10930 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Reopened [ 4 ] => Reopened [ 4 ]

QA Status: Deferred => Done successfully

Test Details: Problem not yet resolved. See note 05/May/20 05:49 AM (here).

=>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Reopened [ 4 ] => Closed [ 6 ]

resolution: Fixed [ 1 ]

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

No branches or pull requests

2 participants