Details
-
Bug
-
Status: Stalled (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
-
None
Description
This is a bit hard to trigger as normally condition in form
date_col=expression yielding invalid_date
|
is converted into multiple-equality where it IS handled correctly.
But MDEV-29363 will expand the set of queries the conversion does not happen and the problem will become more visible.
Test case with the current code (doesn't need the fix for MDEV-29363)
--source include/have_sequence.inc
|
--source include/have_innodb.inc
|
 |
CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB; |
INSERT IGNORE INTO t1 VALUES ('','0000-00-00',0); |
# Works OK
|
SELECT 1 as COL FROM t1 WHERE b= (SELECT a FROM t1 group by c); |
# should produce the same result but it doesn't:
|
SELECT 1 as COL FROM t1 WHERE b IN ((SELECT a FROM t1 group by c), (SELECT a FROM t1 group by c)); |
drop table t1; |
Produces:
CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB;
|
INSERT IGNORE INTO t1 VALUES ('','0000-00-00',0);
|
Warnings:
|
Warning 1265 Data truncated for column 'a' at row 1
|
SELECT 1 as COL FROM t1 WHERE b= (SELECT a FROM t1 group by c);
|
COL
|
1
|
Warnings:
|
Warning 1292 Truncated incorrect datetime value: ''
|
SELECT 1 as COL FROM t1 WHERE b IN ((SELECT a FROM t1 group by c), (SELECT a FROM t1 group by c));
|
COL
|
drop table t1;
|