[MDEV-11586] UNION of FLOAT type results in erroneous precision Created: 2016-12-16 Updated: 2017-10-06 Resolved: 2017-10-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 5.5.53, 10.0.27, 10.1.20, 10.2.2 |
| Fix Version/s: | 10.2.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Nirbhay Choubey (Inactive) | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
|
| Comments |
| Comment by Elena Stepanova [ 2016-12-17 ] | |||||||||||||||||||||
|
Is precision ever guaranteed for float values? Assigning to bar to decide if there is a bug here. | |||||||||||||||||||||
| Comment by Alexander Barkov [ 2017-10-06 ] | |||||||||||||||||||||
|
The difference between "f union 1" and "1 union f" happens because of an asymmetry in the array field_types_merge_rules[][]. 1. FLOAT + INT = DOUBLE Notice, #2 gives a different result. In 10.2 we can change #2 to return DOUBLE instead.
will return:
But I guess the desired result would be to return:
in both queries. | |||||||||||||||||||||
| Comment by Alexander Barkov [ 2017-10-06 ] | |||||||||||||||||||||
|
This script demonstrates that the above asymmetry causes a serious data loss:
Notice, 2147483647 was changed to 2147480000 in the first query. The same problem is repeatable with hybrid function, such as CASE:
|