firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Provide problematic value that leads to arith. exception / num. overflow or string truncation

Open pavel-zotov opened this issue 4 years ago • 0 comments

If we try to violate unique constraint then problematic value is shown. It will be useful to have the same info for SQLSTATE = 22003:

SQL> recreate table test(id int primary key using index test_pk, x int);
SQL> insert into test(id) values(1);
SQL> insert into test(id) values(1);
Statement failed, SQLSTATE = 23000
violation of PRIMARY or UNIQUE KEY constraint "INTEG_2" on table "TEST"
-Problematic key value is ("ID" = 1)

SQL> insert into test(id, x) values(2, power(2,31)-1);
SQL> insert into test(id, x) values(2, power(2,31));
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>

(if this value is string and is very long then just give its starting and ending part, i.e.: 'ABCDEF...XYZ' )

pavel-zotov avatar Oct 18 '21 10:10 pavel-zotov