FirebirdSQL/firebird

Cast dies with numeric value is out of range error (5.0.1 snapshot)

omachtandras opened this issue · 6 comments

Hi,

5.0.1.1398 snapshot

select cast('27' as numeric(4,2))
from rdb$database

causes
arithmetic exception, numeric overflow, or string truncation.
numeric value is out of range.
error.

It works fine with 5.0.0.1306 and 4.0., 3.0.

Looks like it appeared in v4 in commit c909897
For me, results are different:

SQL> select cast('27' as numeric(4,2)) from rdb$database;

   CAST 
======= 
   0.27 

Confirmed, 5.0.1.1408 and 4.0.5.3103 are working fine.
@hvlad, @asfernandes thanks for the fix.

QA note: could not reproduce on 5.0.1.1398-f339eb4
image

PS. Although can be reproduced on 4.0.5.3077 (14-mar-2024) :-)

hvlad commented

QA note: could not reproduce on 5.0.1.1398-f339eb4 image

Do you consider 0.27 as correct result here ?

i did not pay attention on arithmetic correctness of result :-)
just see that no error raised on snapshot 5.0.1.1398