Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
5.5.33a, 5.3.13, 5.5(EOL), 10.0(EOL)
-
None
Description
In MariaDB, it seems that the 3rd argument of the IF() function is consulted to determine how a DECIMAL result is zero-padded when sent back to the client. The behavior is different in MySQL. For example:
In MySQL:
mysql 5.6.21-log (root) [test]> SELECT IF (1=1, ROUND(0.123451, 3), ROUND(0.123451, 5)) as result;
|
--------------
|
SELECT IF (1=1, ROUND(0.123451, 3), ROUND(0.123451, 5)) as result
|
--------------
|
|
Field 1: `result`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: NEWDECIMAL
|
Collation: binary (63)
|
Length: 9
|
Max_length: 5
|
Decimals: 5
|
Flags: NOT_NULL BINARY NUM
|
|
+--------+
|
| result |
|
+--------+
|
| 0.123 |
|
+--------+
|
1 row in set (0.00 sec)
|
And in MariaDB:
mysql 10.0.13-MariaDB-log (root) [test]> SELECT IF (1=1, ROUND(0.123451, 3), ROUND(0.123451, 5)) as result;
|
--------------
|
SELECT IF (1=1, ROUND(0.123451, 3), ROUND(0.123451, 5)) as result
|
--------------
|
|
Field 1: `result`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: NEWDECIMAL
|
Collation: binary (63)
|
Length: 9
|
Max_length: 7
|
Decimals: 5
|
Flags: NOT_NULL BINARY NUM
|
|
+---------+
|
| result |
|
+---------+
|
| 0.12300 |
|
+---------+
|
1 row in set (0.00 sec)
|
Attachments
Issue Links
- is duplicated by
-
MDEV-22362 Number of digits wrong for round if round is within an if or case construct
- Closed