pingcap / pingcap/tidb

Excessive redundant warnings (`1292`) generated during PREPARE statement execution with IN clause

Open
#66,533 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/minor sig/planner 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
mysql> CREATE TABLE t_time (c TIME(6));
Query OK, 0 rows affected (0.01 sec)

-- Scenario 1: Direct Execution
mysql> INSERT INTO t_time VALUES ('02:59:59.000000');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT c FROM t_time WHERE c IN ('NULL','02:59:59.000000');
+-----------------+
| c |
+-----------------+
| 02:59:59.000000 |
+-----------------+
1 row in set, 1 warning (0.00 sec)

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

-- Scenario 2: Prepared Statement Execution
mysql> PREPARE stmt FROM 'SELECT c FROM t_time WHERE c IN (?, ?)';
Query OK, 0 rows affected (0.00 sec)

mysql> SET @a='NULL', @b='02:59:59.000000';
Query OK, 0 rows affected (0.01 sec)

mysql> EXECUTE stmt USING @a, @b;
+-----------------+
| c |
+-----------------+
| 02:59:59.000000 |
+-----------------+
1 row in set, 8 warnings (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
+---------+------+----------------------------------------+
9 rows in set (0.00 sec)
```

### 2. What did you expect to see? (Required)
Both Scenario 1 and Scenario 2 had better generate exactly 1 warning (Warning 1292: Truncated incorrect time value: 'NULL').

### 3. What did you see instead (Required)
```SQL
mysql> EXECUTE stmt USING @a, @b;
+-----------------+
| c |
+-----------------+
| 02:59:59.000000 |
+-----------------+
1 row in set, 8 warnings (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
| Warning | 1292 | Truncated incorrect time value: 'NULL' |
+---------+------+----------------------------------------+
9 rows in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)
```SQL
mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-1262-g086e33bf47
Edition: Community
Git Commit Hash: 086e33bf4765a16810d315bbd83a7eaba889fc68
Git Branch: master
UTC Build Time: 2026-02-26 01:54:12
GoVersion: go1.25.6
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 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.