Exception with parameter issues not invalid value but its complementation to
65536 (when numeric overflow occurs)
-----------------------------------------------------------------------------------------------------------------
Key: CORE-5353
URL: http://tracker.firebirdsql.org/browse/CORE-5353
Project: Firebird Core
Issue Type: Bug
Affects Versions: 3.0.0, 4.0 Initial
Reporter: Pavel Zotov
Consider script:
===
recreate exception foo 'Invalid value detected: @1';
set list on;
set echo on;
set term ^;
execute block as
declare x smallint; -- 'x' is NOT initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = x * 1000; -- make 'x' too big to fit in smallint via arithmetic
expression
when any do
begin
exception foo using(:x);
end
end
^
set term ;^
select 33000 - 65536 from rdb$database;
===
It's STDERR will be:
===
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: *** null ***
-At block line: 7, col: 13
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: -32536
-At block line: 7, col: 13
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: -32536
-At block line: 7, col: 13
===
First exception text (with "-Invalid value detected: *** null ***") can be easy
explained: statement did not change variable content which was null at the
beginning.
Second and third messages produces NOT invalid value but its complementation to
65536 with minus sign.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel