[MDEV-23032] FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column. Created: 2020-06-27 Updated: 2020-10-06 Resolved: 2020-08-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.4.16, 10.5.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Gagan Goel (Inactive) | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
For DECIMAL(M,0), i2 should have M=29, instead of M=28 as in the above. This is because M can exceed by 1 for FLOOR/CEIL functions, for example, when we insert the 2 rows into i1, the result of the functions would contain 29 digits, instead of 28. |
| Comments |
| Comment by Gagan Goel (Inactive) [ 2020-06-27 ] | |||||||||||||||||||||||
|
Attached is a quick patch I wrote to get this case working. | |||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-27 ] | |||||||||||||||||||||||
|
Update: this problem was fixed by A related problem:
| |||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-27 ] | |||||||||||||||||||||||
|
A related problem (now reported in
Looks redundant. A DECIMAL(19,0) or even a BIGINT() column would be enough. | |||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-27 ] | |||||||||||||||||||||||
|
Update: This problem was fixed by A related problem:
Looks redundant. In numeric context SET can return a value beween 0 and 0xFF or between and 0xFFFF, depending on the amount of values in SET. INT should be enough (or even TINYINT/SMALLINT). | |||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-27 ] | |||||||||||||||||||||||
|
Update 2020-06-29: The problem described below was fixed under terms of A related problem:
Looks redundant. FLOOR(time) should never return more than 9 digits (hhhmmss). So INT(9) should be enough. Or even better TIME(0), like in this script:
|