Bug #112703 prepare statment has no warning comping to not prepare statment.
Description:
1. not prepare statment has a warnings,but prepare statment has not warnings;
2. <= 8.0.29, prepare statment has a result, I think it is reasonable.
CREATE TABLE test_time(`time_col` time(6) DEFAULT NULL);
insert into test_time values('02:59:59.000000');
mysql> select time_col from test_time where time_col IN ('NULL','02:59:59.000000');
Empty set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------+
| Warning | 1292 | Incorrect time value: 'NULL' for column 'time_col' at row 1 |
+---------+------+-------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1;deallocate prepare stmt;
Query OK, 0 rows affected (0.00 sec)
Statement prepared
Query OK, 0 rows affected (0.00 sec)
Empty set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
How to repeat:
CREATE TABLE test_time(`time_col` time(6) DEFAULT NULL);
insert into test_time values('02:59:59.000000');
mysql> select time_col from test_time where time_col IN ('NULL','02:59:59.000000');
Empty set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------+
| Warning | 1292 | Incorrect time value: 'NULL' for column 'time_col' at row 1 |
+---------+------+-------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1;deallocate prepare stmt;
Query OK, 0 rows affected (0.00 sec)
Statement prepared
Query OK, 0 rows affected (0.00 sec)
Empty set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Suggested fix:
prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1;
Prepare statment should has a warning. or return a result.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: 1. not prepare statment has a warnings,but prepare statment has not warnings; 2. <= 8.0.29, prepare statment has a result, I think it is reasonable. CREATE TABLE test_time(`time_col` time(6) DEFAULT NULL); insert into test_time values('02:59:59.000000'); mysql> select time_col from test_time where time_col IN ('NULL','02:59:59.000000'); Empty set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+-------------------------------------------------------------+ | Level | Code | Message | +---------+------+-------------------------------------------------------------+ | Warning | 1292 | Incorrect time value: 'NULL' for column 'time_col' at row 1 | +---------+------+-------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1;deallocate prepare stmt; Query OK, 0 rows affected (0.00 sec) Statement prepared Query OK, 0 rows affected (0.00 sec) Empty set (0.00 sec) Query OK, 0 rows affected (0.00 sec) How to repeat: CREATE TABLE test_time(`time_col` time(6) DEFAULT NULL); insert into test_time values('02:59:59.000000'); mysql> select time_col from test_time where time_col IN ('NULL','02:59:59.000000'); Empty set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+-------------------------------------------------------------+ | Level | Code | Message | +---------+------+-------------------------------------------------------------+ | Warning | 1292 | Incorrect time value: 'NULL' for column 'time_col' at row 1 | +---------+------+-------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1;deallocate prepare stmt; Query OK, 0 rows affected (0.00 sec) Statement prepared Query OK, 0 rows affected (0.00 sec) Empty set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Suggested fix: prepare stmt from "select time_col from test_time where time_col IN (?,'02:59:59.000000');";set @time_col1='NULL';execute stmt USING @time_col1; Prepare statment should has a warning. or return a result.