Issue Details (XML | Word | Printable)

Key: CORE-6355
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Alexander Peshkov
Reporter: Pavel Zotov
Votes: 0
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Firebird Core

TRUNC() does not accept second argument = -128 (but shows it as required boundary in error message)

Created: 06/Jul/20 07:07 PM   Updated: 08/Jul/20 09:40 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 4.0 RC 1

QA Status: Done successfully


 Description  « Hide
Rollowing commands have the same issue on 2.5, 3.0 & 4.0:

SQL> set heading off;
SQL> select trunc(1,-127) from rdb$database;

           0

SQL> select trunc(1,-128) from rdb$database;

Statement failed, SQLSTATE = 42000
expression evaluation not supported
-The numeric scale must be between -128 and 127 in TRUNC



 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 07/Jul/20 12:24 PM
I'm not sure the range of [-128, 127] makes sense for the TRUNC function. The range should be the amount of decimal digits, so the correct range would be [-38,38] as far as I can tell. Where does the range [-128, 127] come from?

Alexander Peshkov added a comment - 08/Jul/20 02:49 PM
Also old code accepted (due to same bug) precision == 128.