insert with truncated value doesn't show warnings with tiflash
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
- `tiup playground v8.5.0 --without-monitor --host 0.0.0.0 --tiflash 1 --db 1`
- then run below sqls, **Note: you might need to paste all those statements to the mysql-client console, to produce the warning, it seems the tiflash replica not ready and the cast in insert is run on tidb side, see https://github.com/pingcap/tidb/issues/58607#issuecomment-2565104606**
```sql
mysql> create table t(a double);
Query OK, 0 rows affected (0.03 sec)
mysql> create table s(x varchar(20));
Query OK, 0 rows affected (0.03 sec)
mysql> insert into s values('1e309abc');
Query OK, 1 row affected (0.01 sec)
mysql> alter table s set tiflash replica 1;
Query OK, 0 rows affected (0.04 sec)
mysql> set tidb_enforce_mpp=1; set sql_mode=''; insert into t select cast(x as double) from s; show warnings;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected, 2 warnings (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 2
+---------+------+----------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '1e309abc' |
| Warning | 1292 | Truncated incorrect DOUBLE value: '1e309abc' |
+---------+------+----------------------------------------------+
2 rows in set (0.00 sec)
```
- but if we truncate the table and run again, there is no warnings
```sql
mysql>
mysql> truncate t; insert into t select cast(x as double) from s; show warnings;
Query OK, 0 rows affected (0.04 sec)
Query OK, 1 row affected (0.07 sec)
Records: 1 Duplicates: 0 Warnings: 0
Empty set (0.00 sec)
```
### 2. What did you expect to see? (Required)
### 3. What did you see instead (Required)
### 4. What is your TiDB version? (Required)
8.5
Contributor guide
Assessment
This issue has not been assessed yet.