Closed pcqz closed 6 months ago
it seems can be steadily reproduced on master branch
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test values(1,'11,11');
Query OK, 1 row affected (0.00 sec)
mysql> insert into test1(bglac) select sum(convert(ifnull(bglac, 0), decimal(21,3))) from test;
ERROR 1265 (01000): Data truncated for column '%s' at row %d
mysql>
mysql>
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from test1;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from test;
Query OK, 1 row affected (0.00 sec)
mysql> insert into test values(1,'11,11');
Query OK, 1 row affected (0.00 sec)
mysql> insert into test1(bglac) select sum(convert(ifnull(bglac, 0), decimal(21,3))) from test;
ERROR 1265 (01000): Data truncated for column '%s' at row %d
mysql>
mysql> delete from test;
Query OK, 1 row affected (0.00 sec)
mysql> insert into test values(1,'11,11');
Query OK, 1 row affected (0.00 sec)
mysql> insert into test1(bglac) select sum(convert(ifnull(bglac, 0), decimal(21,3))) from test;
ERROR 1265 (01000): Data truncated for column '%s' at row %d
mysql>
mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.1.0-alpha-109-g1b3700c
Edition: Community
Git Commit Hash: 1b3700c1c1507fadc77dfa512f2f4f251921677b
Git Branch: HEAD
UTC Build Time: 2024-04-17 02:36:26
GoVersion: go1.21.4
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
Reproduced the issue locally. There are two factors that lead to the random behavior:
related with #51879
/close
@gengliqi: Closing this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Unable to reproduce steadily when not in transaction:
Reproduce steadily when in transaction using UnionScan:
2. What did you expect to see? (Required)
No error.
3. What did you see instead (Required)
Sometimes report error if insert is not in transaction:
Always report error in transaction:
4. What is your TiDB version? (Required)
v6.5.2