Truncation during a cast should raise a warning, not an exception
-----------------------------------------------------------------

                 Key: CORE-4686
                 URL: http://tracker.firebirdsql.org/browse/CORE-4686
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0 Beta 1, 2.5.3, 2.1.6
            Reporter: Mark Rotteveel


According to SQL:2011 Foundation, 6.13 <cast specification>, a cast from a 
longer string to a shorter length should succeed with a warning "warning — 
string data, right truncation.", instead Firebird currently raises an error 
instead of a warning: 

SQL Message : -802
Arithmetic overflow or division by zero has occurred.

Engine Code    : 335544321
Engine Message :
arithmetic exception, numeric overflow, or string truncation
string right truncation
expected length 1, actual 4

Simple example: 
SELECT CAST('abcdefgh' AS VARCHAR(1)) FROM RDB$DATABASE

Expected, single column with single row, value 'a'
Actual: above exception

-- 
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

       

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to