Description:
the function Item_func_in returns incorrect result where the compared field type is datetime.
How to repeat:
mysql> CREATE TABLE t1 ( pk INTEGER PRIMARY KEY, col_date date DEFAULT NULL,col_datetime datetime DEFAULT NULL, col_varchar VARCHAR(1) DEFAULT NULL, KEY (col_varchar));
mysql> INSERT INTO t1 VALUES(5, '2022-02-25', '2022-02-25 11:01:14', 'I');
mysql> INSERT INTO t1 VALUES(6, '2022-02-26', '2022-02-26 21:11:24', 'J');
mysql> SELECT * FROM t1 wHERE pk = 5 AND (col_datetime, col_varchar) IN (('2022-02-25 11:01:14', 'Y'), (92, 'W'));
+----+------------+---------------------+-------------+
| pk | col_date | col_datetime | col_varchar |
+----+------------+---------------------+-------------+
| 5 | 2022-02-25 | 2022-02-25 11:01:14 | I |
+----+------------+---------------------+-------------+
mysql> SELECT * FROM t1 wHERE pk = 5 AND (col_varchar, col_datetime) IN (('Y', '2022-02-25 11:01:14'), ('W', 92));
Empty set, 1 warning (0.00 sec)
Description: the function Item_func_in returns incorrect result where the compared field type is datetime. How to repeat: mysql> CREATE TABLE t1 ( pk INTEGER PRIMARY KEY, col_date date DEFAULT NULL,col_datetime datetime DEFAULT NULL, col_varchar VARCHAR(1) DEFAULT NULL, KEY (col_varchar)); mysql> INSERT INTO t1 VALUES(5, '2022-02-25', '2022-02-25 11:01:14', 'I'); mysql> INSERT INTO t1 VALUES(6, '2022-02-26', '2022-02-26 21:11:24', 'J'); mysql> SELECT * FROM t1 wHERE pk = 5 AND (col_datetime, col_varchar) IN (('2022-02-25 11:01:14', 'Y'), (92, 'W')); +----+------------+---------------------+-------------+ | pk | col_date | col_datetime | col_varchar | +----+------------+---------------------+-------------+ | 5 | 2022-02-25 | 2022-02-25 11:01:14 | I | +----+------------+---------------------+-------------+ mysql> SELECT * FROM t1 wHERE pk = 5 AND (col_varchar, col_datetime) IN (('Y', '2022-02-25 11:01:14'), ('W', 92)); Empty set, 1 warning (0.00 sec)