pingcap / pingcap/tidb

Inconsistent warning message

Open
#32,544 1 comment 0 reactions 0 assignees View on GitHub
severity/minor sig/transaction type/bug
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)
```sql
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 FLOAT);
INSERT INTO t0 VALUES(1);
SELECT c0 FROM t0 WHERE t0.c0 > 'a';
SHOW WARNINGS;
UPDATE t0 SET c0 = 2 WHERE t0.c0 > 'a';
SHOW WARNINGS;
```

### 2. What did you expect to see? (Required)
I think the warning message should be the same.
### 3. What did you see instead (Required)
```sql
mysql> SELECT c0 FROM t0 WHERE t0.c0 > 'a';
+------+
| c0 |
+------+
| 1 |
+------+
1 row in set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+---------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'a' |
+---------+------+---------------------------------------+
1 row in set (0.00 sec)

mysql> UPDATE t0 SET c0 = 2 WHERE t0.c0 > 'a';
ERROR 1292 (22007): Truncated incorrect INTEGER value: 'a'
mysql> SHOW WARNINGS;
+-------+------+----------------------------------------+
| Level | Code | Message |
+-------+------+----------------------------------------+
| Error | 1292 | Truncated incorrect INTEGER value: 'a' |
+-------+------+----------------------------------------+
1 row in set (0.00 sec)
```
'a' in SELECT is treated as a DOUBLE value, while in UPDATE is an INTEGER value.
### 4. What is your TiDB version? (Required)

mysql> SELECT tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()
|
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.4.0
Edition: Community
Git Commit Hash: 55f3b24c1c9f506bd652ef1d162283541e428872
Git Branch: heads/refs/tags/v5.4.0
UTC Build Time: 2022-01-25 08:39:26
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.