|
If I compare a DATETIME column to a negative TIME value,
it does not print any warnings:
mysql> drop table if exists t1; create table t1 (f1 datetime, key (f1)); insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); select * from t1 where f1 > time('-00:00:01');
|
Query OK, 0 rows affected (0.05 sec)
|
|
Query OK, 0 rows affected (0.18 sec)
|
|
Query OK, 2 rows affected (0.00 sec)
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
+---------------------+
|
| f1 |
|
+---------------------+
|
| 2000-09-12 00:00:00 |
|
| 2007-04-25 05:08:49 |
|
+---------------------+
|
2 rows in set (0.00 sec)
|
At the same time it does print warnings for negative number:
mysql> select * from t1 where f1 > -1;
|
+---------------------+
|
| f1 |
|
+---------------------+
|
| 2000-09-12 00:00:00 |
|
| 2007-04-25 05:08:49 |
|
+---------------------+
|
2 rows in set, 1 warning (0.00 sec)
|
|
mysql> show warnings;
|
+---------+------+--------------------------------+
|
| Level | Code | Message |
|
+---------+------+--------------------------------+
|
| Warning | 1292 | Incorrect datetime value: '-1' |
|
+---------+------+--------------------------------+
|
1 row in set (0.00 sec)
|
Comparison to TIME should be fixed to print the warning.
|