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

When trying to show "conversion error", "arithmetic exception/string truncation" may appear instead, misleading the user [CORE2001] #2438

Closed
firebird-issue-importer opened this issue Jul 18, 2008 · 7 comments

Comments

@firebird-issue-importer

Submitted by: Claudio Valderrama C. (robocop)

Assigned to: Claudio Valderrama C. (robocop)

Is related to QA354

This is a case of one error causing another.
When FB is asked to convert one data type to another, it may not always succeed. This is the case with explicit user requests (a string that doesn't hold a date is casted to date) or internal conversion from UDF results (the UDF's dynamically returned type doesn't match the declared type), etc.
However, due to the way the conversion error message is produced, it may cause a string truncation when trying to assemble the error message. Therefore, the client application receives "string truncation" instead of "conversion error". Example:

1.- This is correct:
SQL> select cast('1995' as date) from rdb$database;

   CAST

===========
Statement failed, SQLSTATE = 22018
conversion error from string "1995"

2.- This is misleading:
SQL> select cast('1995-12-2444444444444444444444444444444' as date) from rdb$database;

   CAST

===========
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation

3.- This is the fix when the source string is too long to report it or try to convert it:
SQL> select cast('1995-12-2444444444444444444444444444444' as date) from rdb$database;

   CAST

===========
Statement failed, SQLSTATE = 22018
conversion error from string "<Too long string or can't be translated>"

Another solution would be to take a substring of the original string.

Commits: bb672a9

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 18, 2008

Modified by: Claudio Valderrama C. (robocop)

assignee: Claudio Valderrama C. [ robocop ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 27, 2008

Modified by: Claudio Valderrama C. (robocop)

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

resolution: Fixed [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 23, 2011

Modified by: @pcisar

Link: This issue is related to QA354 [ QA354 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 25, 2011

Commented by: @pcisar

QA test added.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 25, 2011

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test => Done successfully

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