Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
22.08.2
-
None
-
None
-
2022-22, 2022-23
Description
Build tested: 22.08.2
It seems to be a data type overflow issue.
The issue was uncovered by MTR test case devregression/r/mcs7085_regression_bug3483.test. Actually, the reference result is also incorrect. The reference result needs to be updated when the issue is fixed.
ColumnStore
MariaDB [mytest]> create table t1 (c1 char(120), c2 varchar(120)) engine=columnstore;
|
Query OK, 0 rows affected (0.228 sec)
|
|
MariaDB [mytest]> insert into t1 values
|
('12345678901234567890', '12345678901234567890'),
|
('12345678901234567890123456789012345678901234567890', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'),
|
('-12345678901234567890', '-12345678901234567890'),
|
('-12345678901234567890123456789012345678901234567890', '-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
|
Query OK, 4 rows affected (0.175 sec)
|
Records: 4 Duplicates: 0 Warnings: 0
|
|
MariaDB [mytest]>
|
MariaDB [mytest]> select c1, truncate(c1, 2) from t1;
|
+-----------------------------------------------------+-----------------------+
|
| c1 | truncate(c1, 2) |
|
+-----------------------------------------------------+-----------------------+
|
| 12345678901234567890 | 92233720368547760.00 |
|
| 12345678901234567890123456789012345678901234567890 | 92233720368547760.00 |
|
| -12345678901234567890 | -92233720368547760.00 |
|
| -12345678901234567890123456789012345678901234567890 | -92233720368547760.00 |
|
+-----------------------------------------------------+-----------------------+
|
4 rows in set (0.026 sec)
|
|
MariaDB [mytest]> select c2, truncate(c2, 2) from t1;
|
+-------------------------------------------------------------------------------------------------------+-----------------------+
|
| c2 | truncate(c2, 2) |
|
+-------------------------------------------------------------------------------------------------------+-----------------------+
|
| 12345678901234567890 | 92233720368547760.00 |
|
| 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 | 92233720368547760.00 |
|
| -12345678901234567890 | -92233720368547760.00 |
|
| -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 | -92233720368547760.00 |
|
+-------------------------------------------------------------------------------------------------------+-----------------------+
|
InnoDB
MariaDB [mytest]> create table t2 (c1 char(120), c2 varchar(120)) engine=innodb;
|
Query OK, 0 rows affected (0.012 sec)
|
|
MariaDB [mytest]> insert into t2 values
|
-> ('12345678901234567890', '12345678901234567890'),
|
-> ('12345678901234567890123456789012345678901234567890', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'),
|
-> ('-12345678901234567890', '-12345678901234567890'),
|
-> ('-12345678901234567890123456789012345678901234567890', '-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
|
Query OK, 4 rows affected (0.000 sec)
|
Records: 4 Duplicates: 0 Warnings: 0
|
|
MariaDB [mytest]>
|
MariaDB [mytest]>
|
MariaDB [mytest]> select c1, truncate(c1, 2) from t2;
|
+-----------------------------------------------------+--------------------------------------------------------+
|
| c1 | truncate(c1, 2) |
|
+-----------------------------------------------------+--------------------------------------------------------+
|
| 12345678901234567890 | 12345678901234567000.00 |
|
| 12345678901234567890123456789012345678901234567890 | 12345678901234567000000000000000000000000000000000.00 |
|
| -12345678901234567890 | -12345678901234567000.00 |
|
| -12345678901234567890123456789012345678901234567890 | -12345678901234567000000000000000000000000000000000.00 |
|
+-----------------------------------------------------+--------------------------------------------------------+
|
4 rows in set (0.000 sec)
|
|
MariaDB [mytest]> select c2, truncate(c2, 2) from t2;
|
+-------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
|
| c2 | truncate(c2, 2) |
|
+-------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
|
| 12345678901234567890 | 12345678901234567000.00 |
|
| 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 | 1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 |
|
| -12345678901234567890 | -12345678901234567000.00 |
|
| -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 | -1234567890123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 |
|
+-------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
|
4 rows in set (0.000 sec)
|
|
Attachments
Issue Links
- relates to
-
MCOL-5283 Add conversion from char to decimal
- Open