← Back
Editing: const_folding.result
# # Tests with UNSIGNED type TINYINT against int # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES (0), (1), (0),(1),(3), (254), (255), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < 256; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 255; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 256; colA SELECT * FROM tinytbl WHERE colA >= 255; colA 255 SELECT * FROM tinytbl WHERE colA > -1; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= -1; colA SELECT * FROM tinytbl WHERE colA <= 0; colA 0 0 SELECT * FROM tinytbl WHERE colA >= 0; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 0; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 256; colA SELECT * FROM tinytbl WHERE colA <> 256; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 255; colA 255 SELECT * FROM tinytbl WHERE colA <=> 255; colA 255 SELECT * FROM tinytbl WHERE NOT(colA <=> 255); colA 0 1 0 1 3 254 NULL SELECT * FROM tinytbl WHERE colA <> 255; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA = 0; colA 0 0 SELECT * FROM tinytbl WHERE colA <=> 0; colA 0 0 SELECT * FROM tinytbl WHERE NOT(colA <=> 0); colA 1 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> 0; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -1; colA SELECT * FROM tinytbl WHERE colA <=> -1; colA SELECT * FROM tinytbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> -1; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @maxint_plus_1=256; SET @maxint=255; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 255 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE colA < 256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= 255; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > 256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA >= 255; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` > 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = 256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> 256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA = 255; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 255; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <> 255; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) same queries but constant first SELECT * FROM tinytbl WHERE 256 > colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE 255 >= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE 256 < colA; colA SELECT * FROM tinytbl WHERE 255 <= colA; colA 255 SELECT * FROM tinytbl WHERE 255 < colA; colA SELECT * FROM tinytbl WHERE -1 < colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE -1 >= colA; colA SELECT * FROM tinytbl WHERE 0 >= colA; colA 0 0 SELECT * FROM tinytbl WHERE 0 <= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE 0 < colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE 256 = colA; colA SELECT * FROM tinytbl WHERE 256 <=> colA; colA SELECT * FROM tinytbl WHERE 256 <> colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE 255 = colA; colA 255 SELECT * FROM tinytbl WHERE 255 <=> colA; colA 255 SELECT * FROM tinytbl WHERE 255 <> colA; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE 0 = colA; colA 0 0 SELECT * FROM tinytbl WHERE 0 <=> colA; colA 0 0 SELECT * FROM tinytbl WHERE 0 <> colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE -1 = colA; colA SELECT * FROM tinytbl WHERE -1 <=> colA; colA SELECT * FROM tinytbl WHERE -1 <> colA; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 255 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE 256 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE 255 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE 256 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 255 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 255 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 < `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 256 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 256 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 256 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE 255 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE 255 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 255 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) DROP TABLE tinytbl; # # Tests with UNSIGNED type TINYINT against decimal # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES (0), (1), (0),(1),(3), (254), (255), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < 0.5; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 0.5; colA 0 0 SELECT * FROM tinytbl WHERE colA > 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.5; colA SELECT * FROM tinytbl WHERE colA <> 0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -0.5; colA SELECT * FROM tinytbl WHERE colA <= -0.5; colA SELECT * FROM tinytbl WHERE colA > -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -0.5; colA SELECT * FROM tinytbl WHERE colA <> -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 255.00001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 255.00001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 255.00001; colA SELECT * FROM tinytbl WHERE colA >= 255.00001; colA SELECT * FROM tinytbl WHERE colA = 255.00001; colA SELECT * FROM tinytbl WHERE colA <> 255.00001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 254.99999; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA <= 254.99999; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA > 254.99999; colA 255 SELECT * FROM tinytbl WHERE colA >= 254.99999; colA 255 SELECT * FROM tinytbl WHERE colA = 254.99999; colA SELECT * FROM tinytbl WHERE colA <> 254.99999; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 0.00001; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 0.00001; colA 0 0 SELECT * FROM tinytbl WHERE colA > 0.00001; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.00001; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.00001; colA SELECT * FROM tinytbl WHERE colA <> 0.00001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -0.99999; colA SELECT * FROM tinytbl WHERE colA <= -0.99999; colA SELECT * FROM tinytbl WHERE colA > -0.99999; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -0.99999; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -0.99999; colA SELECT * FROM tinytbl WHERE colA <> -0.99999; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=255.00001; SET @dec_max_minus_delta=254.99999; SET @dec_min_plus_delta=0.00001; SET @dec_min_minus_delta=-0.99999; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_greater USING @dec_max_minus_delta; colA 255 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 255 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type TINYINT against int # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES ('0'), ('1'), (0),(1),(3), ('254'), ('255'), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < '256'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= '255'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > '256'; colA SELECT * FROM tinytbl WHERE colA >= '255'; colA 255 SELECT * FROM tinytbl WHERE colA > '-1'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= '-1'; colA SELECT * FROM tinytbl WHERE colA <= '0'; colA 0 0 SELECT * FROM tinytbl WHERE colA >= '0'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > '0'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '256'; colA SELECT * FROM tinytbl WHERE colA <> '256'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '255'; colA 255 SELECT * FROM tinytbl WHERE colA <=> '255'; colA 255 SELECT * FROM tinytbl WHERE NOT(colA <=> '255'); colA 0 1 0 1 3 254 NULL SELECT * FROM tinytbl WHERE colA <> '255'; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA = '0'; colA 0 0 SELECT * FROM tinytbl WHERE colA <=> '0'; colA 0 0 SELECT * FROM tinytbl WHERE NOT(colA <=> '0'); colA 1 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> '0'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '-1'; colA SELECT * FROM tinytbl WHERE colA <=> '-1'; colA SELECT * FROM tinytbl WHERE NOT(colA <=> '-1'); colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> '-1'; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @maxint_plus_1='256'; SET @maxint='255'; SET @minint_minus_1='-1'; SET @minint='0'; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 255 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE colA < '256'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= '255'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > '256'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA >= '255'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA > '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA >= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` > 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = '256'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '256'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> '256'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA = '255'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '255'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <> '255'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA = '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) same queries but constant first SELECT * FROM tinytbl WHERE '256' > colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '255' >= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '256' < colA; colA SELECT * FROM tinytbl WHERE '255' <= colA; colA 255 SELECT * FROM tinytbl WHERE '255' < colA; colA SELECT * FROM tinytbl WHERE '-1' < colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '-1' >= colA; colA SELECT * FROM tinytbl WHERE '0' >= colA; colA 0 0 SELECT * FROM tinytbl WHERE '0' <= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '0' < colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE '256' = colA; colA SELECT * FROM tinytbl WHERE '256' <=> colA; colA SELECT * FROM tinytbl WHERE '256' <> colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '255' = colA; colA 255 SELECT * FROM tinytbl WHERE '255' <=> colA; colA 255 SELECT * FROM tinytbl WHERE '255' <> colA; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE '0' = colA; colA 0 0 SELECT * FROM tinytbl WHERE '0' <=> colA; colA 0 0 SELECT * FROM tinytbl WHERE '0' <> colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE '-1' = colA; colA SELECT * FROM tinytbl WHERE '-1' <=> colA; colA SELECT * FROM tinytbl WHERE '-1' <> colA; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 255 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE '256' > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '255' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '256' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '255' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '-1' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 < `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '256' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '256' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '256' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '255' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '-1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) DROP TABLE tinytbl; # # Tests with UNSIGNED type TINYINT against int # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES ('0.0'), ('1.0'), (0),(1),(3), ('254.0'), ('255.0'), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < '256.1'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= '255.0'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > '256.1'; colA SELECT * FROM tinytbl WHERE colA >= '255.0'; colA 255 SELECT * FROM tinytbl WHERE colA > '-1.1'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= '-1.1'; colA SELECT * FROM tinytbl WHERE colA <= '0.0'; colA 0 0 SELECT * FROM tinytbl WHERE colA >= '0.0'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > '0.0'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '256.1'; colA SELECT * FROM tinytbl WHERE colA <> '256.1'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '255.0'; colA 255 SELECT * FROM tinytbl WHERE colA <=> '255.0'; colA 255 SELECT * FROM tinytbl WHERE NOT(colA <=> '255.0'); colA 0 1 0 1 3 254 NULL SELECT * FROM tinytbl WHERE colA <> '255.0'; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA = '0.0'; colA 0 0 SELECT * FROM tinytbl WHERE colA <=> '0.0'; colA 0 0 SELECT * FROM tinytbl WHERE NOT(colA <=> '0.0'); colA 1 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> '0.0'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '-1.1'; colA SELECT * FROM tinytbl WHERE colA <=> '-1.1'; colA SELECT * FROM tinytbl WHERE NOT(colA <=> '-1.1'); colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA <> '-1.1'; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @maxint_plus_1='256.1'; SET @maxint='255.0'; SET @minint_minus_1='-1.1'; SET @minint='0.0'; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 255 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE colA < '256.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= '255.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > '256.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA >= '255.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA > '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA <= '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA >= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA > '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` > 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = '256.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '256.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> '256.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE colA = '255.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '255.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <> '255.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA = '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <> '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) same queries but constant first SELECT * FROM tinytbl WHERE '256.1' > colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '255.0' >= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '256.1' < colA; colA SELECT * FROM tinytbl WHERE '255.0' <= colA; colA 255 SELECT * FROM tinytbl WHERE '255.0' < colA; colA SELECT * FROM tinytbl WHERE '-1.1' < colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '-1.1' >= colA; colA SELECT * FROM tinytbl WHERE '0.0' >= colA; colA 0 0 SELECT * FROM tinytbl WHERE '0.0' <= colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '0.0' < colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE '256.1' = colA; colA SELECT * FROM tinytbl WHERE '256.1' <=> colA; colA SELECT * FROM tinytbl WHERE '256.1' <> colA; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE '255.0' = colA; colA 255 SELECT * FROM tinytbl WHERE '255.0' <=> colA; colA 255 SELECT * FROM tinytbl WHERE '255.0' <> colA; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE '0.0' = colA; colA 0 0 SELECT * FROM tinytbl WHERE '0.0' <=> colA; colA 0 0 SELECT * FROM tinytbl WHERE '0.0' <> colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE '-1.1' = colA; colA SELECT * FROM tinytbl WHERE '-1.1' <=> colA; colA SELECT * FROM tinytbl WHERE '-1.1' <> colA; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 255 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 NULL EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE '256.1' > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '255.0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '256.1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '255.0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255.0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1.1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '-1.1' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '0.0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0.0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '0.0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 < `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '256.1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '256.1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '256.1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) EXPLAIN SELECT * FROM tinytbl WHERE '255.0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255.0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '255.0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0.0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0.0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '0.0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE '-1.1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1.1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE '-1.1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` is not null) DROP TABLE tinytbl; # # Tests with UNSIGNED type TINYINT against decimal # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES ('0.0'), ('1.0'), (0),(1),(3), ('254.0'), ('255.0'), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < 0.5; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 0.5; colA 0 0 SELECT * FROM tinytbl WHERE colA > 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.5; colA SELECT * FROM tinytbl WHERE colA <> 0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -0.5; colA SELECT * FROM tinytbl WHERE colA <= -0.5; colA SELECT * FROM tinytbl WHERE colA > -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -0.5; colA SELECT * FROM tinytbl WHERE colA <> -0.5; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < '255.00001'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= '255.00001'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > '255.00001'; colA SELECT * FROM tinytbl WHERE colA >= '255.00001'; colA SELECT * FROM tinytbl WHERE colA = '255.00001'; colA SELECT * FROM tinytbl WHERE colA <> '255.00001'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < '254.99999'; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA <= '254.99999'; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA > '254.99999'; colA 255 SELECT * FROM tinytbl WHERE colA >= '254.99999'; colA 255 SELECT * FROM tinytbl WHERE colA = '254.99999'; colA SELECT * FROM tinytbl WHERE colA <> '254.99999'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < '0.00001'; colA 0 0 SELECT * FROM tinytbl WHERE colA <= '0.00001'; colA 0 0 SELECT * FROM tinytbl WHERE colA > '0.00001'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= '0.00001'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '0.00001'; colA SELECT * FROM tinytbl WHERE colA <> '0.00001'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < '-0.99999'; colA SELECT * FROM tinytbl WHERE colA <= '-0.99999'; colA SELECT * FROM tinytbl WHERE colA > '-0.99999'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= '-0.99999'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '-0.99999'; colA SELECT * FROM tinytbl WHERE colA <> '-0.99999'; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta='255.00001'; SET @dec_max_minus_delta='254.99999'; SET @dec_min_plus_delta='0.00001'; SET @dec_min_minus_delta='-0.99999'; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_greater USING @dec_max_minus_delta; colA 255 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 255 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type TINYINT against reals # CREATE TABLE tinytbl (colA TINYINT UNSIGNED ); INSERT INTO tinytbl VALUES (0.0E+00), (1.0E00), (0),(1),(3), (2.54E02), (2.55E02), (NULL); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 NULL SELECT * FROM tinytbl WHERE colA < 0.5E00; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 0.5E00; colA 0 0 SELECT * FROM tinytbl WHERE colA > 0.5E00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.5E00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.5E00; colA SELECT * FROM tinytbl WHERE colA <> 0.5E00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -0.5E00; colA SELECT * FROM tinytbl WHERE colA <= -0.5E00; colA SELECT * FROM tinytbl WHERE colA > -0.5E00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -0.5E00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -0.5E00; colA SELECT * FROM tinytbl WHERE colA <> -0.5E00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 255.00001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 255.00001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 255.00001E+00; colA SELECT * FROM tinytbl WHERE colA >= 255.00001E+00; colA SELECT * FROM tinytbl WHERE colA = 255.00001E+00; colA SELECT * FROM tinytbl WHERE colA <> 255.00001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 254.99999E+00; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA <= 254.99999E+00; colA 0 1 0 1 3 254 SELECT * FROM tinytbl WHERE colA > 254.99999E+00; colA 255 SELECT * FROM tinytbl WHERE colA >= 254.99999E+00; colA 255 SELECT * FROM tinytbl WHERE colA = 254.99999E+00; colA SELECT * FROM tinytbl WHERE colA <> 254.99999E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 0.00001E+00; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 0.00001E+00; colA 0 0 SELECT * FROM tinytbl WHERE colA > 0.00001E+00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.00001E+00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.00001E+00; colA SELECT * FROM tinytbl WHERE colA <> 0.00001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -0.99999E+00; colA SELECT * FROM tinytbl WHERE colA <= -0.99999E+00; colA SELECT * FROM tinytbl WHERE colA > -0.99999E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -0.99999E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -0.99999E+00; colA SELECT * FROM tinytbl WHERE colA <> -0.99999E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 18446744073709551615.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 18446744073709551615.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 18446744073709551615.00000001E+00; colA SELECT * FROM tinytbl WHERE colA >= 18446744073709551615.00000001E+00; colA SELECT * FROM tinytbl WHERE colA = 18446744073709551615.00000001E+00; colA SELECT * FROM tinytbl WHERE colA <> 18446744073709551615.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -9223372036854775808.00000001E+00; colA SELECT * FROM tinytbl WHERE colA <= -9223372036854775808.00000001E+00; colA SELECT * FROM tinytbl WHERE colA > -9223372036854775808.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -9223372036854775808.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -9223372036854775808.00000001E+00; colA SELECT * FROM tinytbl WHERE colA <> -9223372036854775808.00000001E+00; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA <= 1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA > 1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA >= 1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA = 1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA <> 1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA <= -1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA > -1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -1.7976931348623157E+308; colA SELECT * FROM tinytbl WHERE colA <> -1.7976931348623157E+308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < 1.7976931348623157E-308; colA 0 0 SELECT * FROM tinytbl WHERE colA <= 1.7976931348623157E-308; colA 0 0 SELECT * FROM tinytbl WHERE colA > 1.7976931348623157E-308; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 1.7976931348623157E-308; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 1.7976931348623157E-308; colA SELECT * FROM tinytbl WHERE colA <> 1.7976931348623157E-308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA < -1.7976931348623157E-308; colA SELECT * FROM tinytbl WHERE colA <= -1.7976931348623157E-308; colA SELECT * FROM tinytbl WHERE colA > -1.7976931348623157E-308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= -1.7976931348623157E-308; colA 0 1 0 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -1.7976931348623157E-308; colA SELECT * FROM tinytbl WHERE colA <> -1.7976931348623157E-308; colA 0 1 0 1 3 254 255 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @real_0_5=0.5E00; SET @real_minus_0_5=-0.5E00; SET @real_max_plus_delta=255.00001E+00; SET @real_max_minus_delta=254.99999E+00; SET @real_min_plus_delta=0.00001E+00; SET @real_min_minus_delta=-0.99999E+00; SET @real_too_big_positive_for_any_int=18446744073709551615.00000001E+00; SET @real_dec_too_big_negative_for_any_int=-9223372036854775808.00000001E+00; SET @real_too_big_positive_for_any_decimal=1.7976931348623157E+308; SET @real_too_big_negative_for_any_decimal=-1.7976931348623157E+308; SET @dec_too_small_positive_for_any_int_as_real=1.7976931348623157E-308; SET @dec_too_small_negative_for_any_int_as_real=-1.7976931348623157E-308; SET @real_too_small_positive_for_any_decimal=1.7976931348623157E-308; SET @real_too_small_negative_for_any_decimal=-1.7976931348623157E-308; EXECUTE p_less USING @real_0_5; colA 0 0 EXECUTE p_less_eq USING @real_0_5; colA 0 0 EXECUTE p_greater USING @real_0_5; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @real_0_5; colA 1 1 3 254 255 EXECUTE p_equal USING @real_0_5; colA EXECUTE p_n_equal USING @real_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_minus_0_5; colA EXECUTE p_less_eq USING @real_minus_0_5; colA EXECUTE p_greater USING @real_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @real_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @real_minus_0_5; colA EXECUTE p_n_equal USING @real_minus_0_5; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @real_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @real_max_plus_delta; colA EXECUTE p_gret_eq USING @real_max_plus_delta; colA EXECUTE p_equal USING @real_max_plus_delta; colA EXECUTE p_n_equal USING @real_max_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_less_eq USING @real_max_minus_delta; colA 0 1 0 1 3 254 EXECUTE p_greater USING @real_max_minus_delta; colA 255 EXECUTE p_gret_eq USING @real_max_minus_delta; colA 255 EXECUTE p_equal USING @real_max_minus_delta; colA EXECUTE p_n_equal USING @real_max_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @real_min_plus_delta; colA 0 0 EXECUTE p_greater USING @real_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @real_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_equal USING @real_min_plus_delta; colA EXECUTE p_n_equal USING @real_min_plus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_min_minus_delta; colA EXECUTE p_less_eq USING @real_min_minus_delta; colA EXECUTE p_greater USING @real_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @real_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @real_min_minus_delta; colA EXECUTE p_n_equal USING @real_min_minus_delta; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @real_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @real_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @real_too_big_positive_for_any_int; colA EXECUTE p_equal USING @real_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @real_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @real_dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @real_dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @real_dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @real_dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @real_dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_too_big_positive_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_less_eq USING @real_too_big_positive_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_greater USING @real_too_big_positive_for_any_decimal; colA EXECUTE p_gret_eq USING @real_too_big_positive_for_any_decimal; colA EXECUTE p_equal USING @real_too_big_positive_for_any_decimal; colA EXECUTE p_n_equal USING @real_too_big_positive_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_too_big_negative_for_any_decimal; colA EXECUTE p_less_eq USING @real_too_big_negative_for_any_decimal; colA EXECUTE p_greater USING @real_too_big_negative_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @real_too_big_negative_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @real_too_big_negative_for_any_decimal; colA EXECUTE p_n_equal USING @real_too_big_negative_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_too_small_positive_for_any_decimal; colA 0 0 EXECUTE p_less_eq USING @real_too_small_positive_for_any_decimal; colA 0 0 EXECUTE p_greater USING @real_too_small_positive_for_any_decimal; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @real_too_small_positive_for_any_decimal; colA 1 1 3 254 255 EXECUTE p_equal USING @real_too_small_positive_for_any_decimal; colA EXECUTE p_n_equal USING @real_too_small_positive_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_less USING @real_too_small_negative_for_any_decimal; colA EXECUTE p_less_eq USING @real_too_small_negative_for_any_decimal; colA EXECUTE p_greater USING @real_too_small_negative_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_gret_eq USING @real_too_small_negative_for_any_decimal; colA 0 1 0 1 3 254 255 EXECUTE p_equal USING @real_too_small_negative_for_any_decimal; colA EXECUTE p_n_equal USING @real_too_small_negative_for_any_decimal; colA 0 1 0 1 3 254 255 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbl; # # Tests with UNSIGNED type TINYINT NOT NULL against int # CREATE TABLE tinytbl (colA TINYINT UNSIGNED NOT NULL); INSERT INTO tinytbl VALUES (0.0E+00), (1.0E00), (0),(1),(3), (2.54E02), (2.55E02), (0); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < 2.56E02; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA <= 2.55E02; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA > 2.56E02; colA SELECT * FROM tinytbl WHERE colA >= 2.55E02; colA 255 SELECT * FROM tinytbl WHERE colA > -1.0E00; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA <= -1.0E00; colA SELECT * FROM tinytbl WHERE colA <= 0.0E+00; colA 0 0 0 SELECT * FROM tinytbl WHERE colA >= 0.0E+00; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA > 0.0E+00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 2.56E02; colA SELECT * FROM tinytbl WHERE colA <> 2.56E02; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA = 2.55E02; colA 255 SELECT * FROM tinytbl WHERE colA <=> 2.55E02; colA 255 SELECT * FROM tinytbl WHERE NOT(colA <=> 2.55E02); colA 0 1 0 1 3 254 0 SELECT * FROM tinytbl WHERE colA <> 2.55E02; colA 0 1 0 1 3 254 0 SELECT * FROM tinytbl WHERE colA = 0.0E+00; colA 0 0 0 SELECT * FROM tinytbl WHERE colA <=> 0.0E+00; colA 0 0 0 SELECT * FROM tinytbl WHERE NOT(colA <=> 0.0E+00); colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA <> 0.0E+00; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = -1.0E00; colA SELECT * FROM tinytbl WHERE colA <=> -1.0E00; colA SELECT * FROM tinytbl WHERE NOT(colA <=> -1.0E00); colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA <> -1.0E00; colA 0 1 0 1 3 254 255 0 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @maxint_plus_1=2.56E02; SET @maxint=2.55E02; SET @minint_minus_1=-1.0E00; SET @minint=0.0E+00; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 254 255 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 255 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 254 255 0 EXECUTE p_greater USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE colA < 2.56E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE colA <= 2.55E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE colA > 2.56E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA >= 2.55E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA > -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE colA <= -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <= 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA >= 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE colA > 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` > 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = 2.56E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 2.56E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> 2.56E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE colA = 2.55E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 2.55E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA <> 2.55E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 255) EXPLAIN SELECT * FROM tinytbl WHERE colA = 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` = 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <=> 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <=> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA <> 0.0E+00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (`test`.`tinytbl`.`colA` <> 0) EXPLAIN SELECT * FROM tinytbl WHERE colA = -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <=> -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE colA <> -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true same queries but constant first SELECT * FROM tinytbl WHERE 2.56E02 > colA; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE 2.55E02 >= colA; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE 2.56E02 < colA; colA SELECT * FROM tinytbl WHERE 2.55E02 <= colA; colA 255 SELECT * FROM tinytbl WHERE 2.55E02 < colA; colA SELECT * FROM tinytbl WHERE -1.0E00 < colA; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE -1.0E00 >= colA; colA SELECT * FROM tinytbl WHERE 0.0E+00 >= colA; colA 0 0 0 SELECT * FROM tinytbl WHERE 0.0E+00 <= colA; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE 0.0E+00 < colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE 2.56E02 = colA; colA SELECT * FROM tinytbl WHERE 2.56E02 <=> colA; colA SELECT * FROM tinytbl WHERE 2.56E02 <> colA; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE 2.55E02 = colA; colA 255 SELECT * FROM tinytbl WHERE 2.55E02 <=> colA; colA 255 SELECT * FROM tinytbl WHERE 2.55E02 <> colA; colA 0 1 0 1 3 254 0 SELECT * FROM tinytbl WHERE 0.0E+00 = colA; colA 0 0 0 SELECT * FROM tinytbl WHERE 0.0E+00 <=> colA; colA 0 0 0 SELECT * FROM tinytbl WHERE 0.0E+00 <> colA; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE -1.0E00 = colA; colA SELECT * FROM tinytbl WHERE -1.0E00 <=> colA; colA SELECT * FROM tinytbl WHERE -1.0E00 <> colA; colA 0 1 0 1 3 254 255 0 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 255 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_eq USING @maxint; colA 255 EXECUTE p_equal USING @maxint; colA 255 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 254 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 254 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 254 255 EXECUTE p_n_equal USING @minint; colA 1 1 3 254 255 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 254 255 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbl WHERE 2.56E02 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE 2.56E02 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1.0E00 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE -1.0E00 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 < `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 2.56E02 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 2.56E02 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE 2.56E02 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 2.55E02 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (255 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 = `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <=> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE 0.0E+00 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where (0 <> `test`.`tinytbl`.`colA`) EXPLAIN SELECT * FROM tinytbl WHERE -1.0E00 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1.0E00 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where false EXPLAIN SELECT * FROM tinytbl WHERE -1.0E00 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbl`.`colA` AS `colA` from `test`.`tinytbl` where true DROP TABLE tinytbl; # # Tests with UNSIGNED type TINYINT NOT NULL against decimal # CREATE TABLE tinytbl (colA TINYINT UNSIGNED NOT NULL); INSERT INTO tinytbl VALUES (0.0E+00), (1.0E00), (0),(1),(3), (2.54E02), (2.55E02), (0); ANALYZE TABLE tinytbl; Table Op Msg_type Msg_text test.tinytbl analyze status OK SELECT * FROM tinytbl; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < 0.5; colA 0 0 0 SELECT * FROM tinytbl WHERE colA <= 0.5; colA 0 0 0 SELECT * FROM tinytbl WHERE colA > 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= 0.5; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = 0.5; colA SELECT * FROM tinytbl WHERE colA <> 0.5; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < -0.5; colA SELECT * FROM tinytbl WHERE colA <= -0.5; colA SELECT * FROM tinytbl WHERE colA > -0.5; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA >= -0.5; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA = -0.5; colA SELECT * FROM tinytbl WHERE colA <> -0.5; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < '255.00001'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA <= '255.00001'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA > '255.00001'; colA SELECT * FROM tinytbl WHERE colA >= '255.00001'; colA SELECT * FROM tinytbl WHERE colA = '255.00001'; colA SELECT * FROM tinytbl WHERE colA <> '255.00001'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < '254.99999'; colA 0 1 0 1 3 254 0 SELECT * FROM tinytbl WHERE colA <= '254.99999'; colA 0 1 0 1 3 254 0 SELECT * FROM tinytbl WHERE colA > '254.99999'; colA 255 SELECT * FROM tinytbl WHERE colA >= '254.99999'; colA 255 SELECT * FROM tinytbl WHERE colA = '254.99999'; colA SELECT * FROM tinytbl WHERE colA <> '254.99999'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < '0.00001'; colA 0 0 0 SELECT * FROM tinytbl WHERE colA <= '0.00001'; colA 0 0 0 SELECT * FROM tinytbl WHERE colA > '0.00001'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA >= '0.00001'; colA 1 1 3 254 255 SELECT * FROM tinytbl WHERE colA = '0.00001'; colA SELECT * FROM tinytbl WHERE colA <> '0.00001'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < '-0.99999'; colA SELECT * FROM tinytbl WHERE colA <= '-0.99999'; colA SELECT * FROM tinytbl WHERE colA > '-0.99999'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA >= '-0.99999'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA = '-0.99999'; colA SELECT * FROM tinytbl WHERE colA <> '-0.99999'; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM tinytbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 0 SELECT * FROM tinytbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM tinytbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 254 255 0 PREPARE p_less FROM 'SELECT * FROM tinytbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta='255.00001'; SET @dec_max_minus_delta='254.99999'; SET @dec_min_plus_delta='0.00001'; SET @dec_min_minus_delta='-0.99999'; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 0 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 0 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 254 0 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 254 0 EXECUTE p_greater USING @dec_max_minus_delta; colA 255 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 255 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 254 255 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 0 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 0 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 254 255 0 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 0 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 0 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 254 255 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with type TINYINT against int # CREATE TABLE tinytbls (colA TINYINT ); INSERT INTO tinytbls VALUES (-128), (-127), (0),(1),(3), (126), (127), (NULL); ANALYZE TABLE tinytbls; Table Op Msg_type Msg_text test.tinytbls analyze status OK SELECT * FROM tinytbls; colA -128 -127 0 1 3 126 127 NULL SELECT * FROM tinytbls WHERE colA < 128; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA <= 127; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA > 128; colA SELECT * FROM tinytbls WHERE colA >= 127; colA 127 SELECT * FROM tinytbls WHERE colA > -129; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA <= -129; colA SELECT * FROM tinytbls WHERE colA <= -128; colA -128 SELECT * FROM tinytbls WHERE colA >= -128; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA > -128; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = 128; colA SELECT * FROM tinytbls WHERE colA <> 128; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = 127; colA 127 SELECT * FROM tinytbls WHERE colA <=> 127; colA 127 SELECT * FROM tinytbls WHERE NOT(colA <=> 127); colA -128 -127 0 1 3 126 NULL SELECT * FROM tinytbls WHERE colA <> 127; colA -128 -127 0 1 3 126 SELECT * FROM tinytbls WHERE colA = -128; colA -128 SELECT * FROM tinytbls WHERE colA <=> -128; colA -128 SELECT * FROM tinytbls WHERE NOT(colA <=> -128); colA -127 0 1 3 126 127 NULL SELECT * FROM tinytbls WHERE colA <> -128; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = -129; colA SELECT * FROM tinytbls WHERE colA <=> -129; colA SELECT * FROM tinytbls WHERE NOT(colA <=> -129); colA -128 -127 0 1 3 126 127 NULL SELECT * FROM tinytbls WHERE colA <> -129; colA -128 -127 0 1 3 126 127 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbls WHERE colA <> ?'; SET @maxint_plus_1=128; SET @maxint=127; SET @minint_minus_1=-129; SET @minint=-128; EXECUTE p_less USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_less_eq USING @maxint; colA -128 -127 0 1 3 126 127 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 127 EXECUTE p_greater USING @minint_minus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -128 EXECUTE p_gret_eq USING @minint; colA -128 -127 0 1 3 126 127 EXECUTE p_greater USING @minint; colA -127 0 1 3 126 127 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_n_equal USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 NULL EXECUTE p_eq USING @maxint; colA 127 EXECUTE p_equal USING @maxint; colA 127 EXECUTE p_n_eq USING @maxint; colA -128 -127 0 1 3 126 EXECUTE p_n_equal USING @maxint; colA -128 -127 0 1 3 126 NULL EXECUTE p_eq USING @minint; colA -128 EXECUTE p_equal USING @minint; colA -128 EXECUTE p_n_eq USING @minint; colA -127 0 1 3 126 127 EXECUTE p_n_equal USING @minint; colA -127 0 1 3 126 127 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_n_equal USING @minint_minus_1; colA -128 -127 0 1 3 126 127 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbls WHERE colA < 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE colA <= 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE colA > 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA >= 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE colA > -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE colA <= -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <= -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA >= -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE colA > -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` > <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA = 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <=> 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <> 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE colA = 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE colA <=> 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <=> 127) EXPLAIN SELECT * FROM tinytbls WHERE colA <> 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <> 127) EXPLAIN SELECT * FROM tinytbls WHERE colA = -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA <=> -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <=> <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA <> -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <> <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA = -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <=> -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <> -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) same queries but constant first SELECT * FROM tinytbls WHERE 128 > colA; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE 127 >= colA; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE 128 < colA; colA SELECT * FROM tinytbls WHERE 127 <= colA; colA 127 SELECT * FROM tinytbls WHERE 127 < colA; colA SELECT * FROM tinytbls WHERE -129 < colA; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE -129 >= colA; colA SELECT * FROM tinytbls WHERE -128 >= colA; colA -128 SELECT * FROM tinytbls WHERE -128 <= colA; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE -128 < colA; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE 128 = colA; colA SELECT * FROM tinytbls WHERE 128 <=> colA; colA SELECT * FROM tinytbls WHERE 128 <> colA; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE 127 = colA; colA 127 SELECT * FROM tinytbls WHERE 127 <=> colA; colA 127 SELECT * FROM tinytbls WHERE 127 <> colA; colA -128 -127 0 1 3 126 SELECT * FROM tinytbls WHERE -128 = colA; colA -128 SELECT * FROM tinytbls WHERE -128 <=> colA; colA -128 SELECT * FROM tinytbls WHERE -128 <> colA; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE -129 = colA; colA SELECT * FROM tinytbls WHERE -129 <=> colA; colA SELECT * FROM tinytbls WHERE -129 <> colA; colA -128 -127 0 1 3 126 127 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_gret_eq USING @maxint; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 127 EXECUTE p_less USING @minint_minus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -128 EXECUTE p_less_eq USING @minint; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @minint; colA -127 0 1 3 126 127 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_n_equal USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 NULL EXECUTE p_eq USING @maxint; colA 127 EXECUTE p_equal USING @maxint; colA 127 EXECUTE p_n_eq USING @maxint; colA -128 -127 0 1 3 126 EXECUTE p_n_equal USING @maxint; colA -128 -127 0 1 3 126 NULL EXECUTE p_eq USING @minint; colA -128 EXECUTE p_equal USING @minint; colA -128 EXECUTE p_n_eq USING @minint; colA -127 0 1 3 126 127 EXECUTE p_n_equal USING @minint; colA -127 0 1 3 126 127 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -128 -127 0 1 3 126 127 EXECUTE p_n_equal USING @minint_minus_1; colA -128 -127 0 1 3 126 127 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbls WHERE 128 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE 127 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE 128 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 127 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 = `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 127 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE -129 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -128 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) = `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE -128 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) < `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 128 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 128 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 128 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) EXPLAIN SELECT * FROM tinytbls WHERE 127 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE 127 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 <=> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 127 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 <> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE -128 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) <=> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) <> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -129 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` is not null) DROP TABLE tinytbls; # # Tests with type TINYINT against decimal # CREATE TABLE tinytbls (colA TINYINT ); INSERT INTO tinytbls VALUES (-128), (-127), (0),(1),(3), (126), (127), (NULL); ANALYZE TABLE tinytbls; Table Op Msg_type Msg_text test.tinytbls analyze status OK SELECT * FROM tinytbls; colA -128 -127 0 1 3 126 127 NULL SELECT * FROM tinytbls WHERE colA < 0.5; colA -128 -127 0 SELECT * FROM tinytbls WHERE colA <= 0.5; colA -128 -127 0 SELECT * FROM tinytbls WHERE colA > 0.5; colA 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= 0.5; colA 1 3 126 127 SELECT * FROM tinytbls WHERE colA = 0.5; colA SELECT * FROM tinytbls WHERE colA <> 0.5; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < -0.5; colA -128 -127 SELECT * FROM tinytbls WHERE colA <= -0.5; colA -128 -127 SELECT * FROM tinytbls WHERE colA > -0.5; colA 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= -0.5; colA 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = -0.5; colA SELECT * FROM tinytbls WHERE colA <> -0.5; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < 127.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA <= 127.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA > 127.00001; colA SELECT * FROM tinytbls WHERE colA >= 127.00001; colA SELECT * FROM tinytbls WHERE colA = 127.00001; colA SELECT * FROM tinytbls WHERE colA <> 127.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < 126.99999; colA -128 -127 0 1 3 126 SELECT * FROM tinytbls WHERE colA <= 126.99999; colA -128 -127 0 1 3 126 SELECT * FROM tinytbls WHERE colA > 126.99999; colA 127 SELECT * FROM tinytbls WHERE colA >= 126.99999; colA 127 SELECT * FROM tinytbls WHERE colA = 126.99999; colA SELECT * FROM tinytbls WHERE colA <> 126.99999; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < -127.99999; colA -128 SELECT * FROM tinytbls WHERE colA <= -127.99999; colA -128 SELECT * FROM tinytbls WHERE colA > -127.99999; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= -127.99999; colA -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = -127.99999; colA SELECT * FROM tinytbls WHERE colA <> -127.99999; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < -128.00001; colA SELECT * FROM tinytbls WHERE colA <= -128.00001; colA SELECT * FROM tinytbls WHERE colA > -128.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= -128.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = -128.00001; colA SELECT * FROM tinytbls WHERE colA <> -128.00001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA <= 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA <> 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA > -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 SELECT * FROM tinytbls WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA <> -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=127.00001; SET @dec_max_minus_delta=126.99999; SET @dec_min_plus_delta=-127.99999; SET @dec_min_minus_delta=-128.00001; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA -128 -127 0 EXECUTE p_less_eq USING @dec_0_5; colA -128 -127 0 EXECUTE p_greater USING @dec_0_5; colA 1 3 126 127 EXECUTE p_gret_eq USING @dec_0_5; colA 1 3 126 127 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_minus_0_5; colA -128 -127 EXECUTE p_less_eq USING @dec_minus_0_5; colA -128 -127 EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 3 126 127 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 3 126 127 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_less_eq USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 EXECUTE p_less_eq USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 EXECUTE p_greater USING @dec_max_minus_delta; colA 127 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 127 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_min_plus_delta; colA -128 EXECUTE p_less_eq USING @dec_min_plus_delta; colA -128 EXECUTE p_greater USING @dec_min_plus_delta; colA -127 0 1 3 126 127 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA -127 0 1 3 126 127 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbls; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with type TINYINT NOT NULL against int # CREATE TABLE tinytbls (colA TINYINT NOT NULL); INSERT INTO tinytbls VALUES (-128), (-127), (0),(1),(3), (126), (127), (0); ANALYZE TABLE tinytbls; Table Op Msg_type Msg_text test.tinytbls analyze status OK SELECT * FROM tinytbls; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < 128; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <= 127; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA > 128; colA SELECT * FROM tinytbls WHERE colA >= 127; colA 127 SELECT * FROM tinytbls WHERE colA > -129; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <= -129; colA SELECT * FROM tinytbls WHERE colA <= -128; colA -128 SELECT * FROM tinytbls WHERE colA >= -128; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA > -128; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = 128; colA SELECT * FROM tinytbls WHERE colA <> 128; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = 127; colA 127 SELECT * FROM tinytbls WHERE colA <=> 127; colA 127 SELECT * FROM tinytbls WHERE NOT(colA <=> 127); colA -128 -127 0 1 3 126 0 SELECT * FROM tinytbls WHERE colA <> 127; colA -128 -127 0 1 3 126 0 SELECT * FROM tinytbls WHERE colA = -128; colA -128 SELECT * FROM tinytbls WHERE colA <=> -128; colA -128 SELECT * FROM tinytbls WHERE NOT(colA <=> -128); colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <> -128; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = -129; colA SELECT * FROM tinytbls WHERE colA <=> -129; colA SELECT * FROM tinytbls WHERE NOT(colA <=> -129); colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <> -129; colA -128 -127 0 1 3 126 127 0 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM tinytbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbls WHERE colA <> ?'; SET @maxint_plus_1=128; SET @maxint=127; SET @minint_minus_1=-129; SET @minint=-128; EXECUTE p_less USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less_eq USING @maxint; colA -128 -127 0 1 3 126 127 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 127 EXECUTE p_greater USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -128 EXECUTE p_gret_eq USING @minint; colA -128 -127 0 1 3 126 127 0 EXECUTE p_greater USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_eq USING @maxint; colA 127 EXECUTE p_equal USING @maxint; colA 127 EXECUTE p_n_eq USING @maxint; colA -128 -127 0 1 3 126 0 EXECUTE p_n_equal USING @maxint; colA -128 -127 0 1 3 126 0 EXECUTE p_eq USING @minint; colA -128 EXECUTE p_equal USING @minint; colA -128 EXECUTE p_n_eq USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbls WHERE colA < 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE colA <= 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE colA > 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA >= 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE colA > -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE colA <= -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <= -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA >= -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE colA > -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` > <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA = 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <=> 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <> 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE colA = 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE colA <=> 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <=> 127) EXPLAIN SELECT * FROM tinytbls WHERE colA <> 127; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <> 127) EXPLAIN SELECT * FROM tinytbls WHERE colA = -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA <=> -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <=> <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA <> -128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` <> <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE colA = -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <=> -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE colA <> -129; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true same queries but constant first SELECT * FROM tinytbls WHERE 128 > colA; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE 127 >= colA; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE 128 < colA; colA SELECT * FROM tinytbls WHERE 127 <= colA; colA 127 SELECT * FROM tinytbls WHERE 127 < colA; colA SELECT * FROM tinytbls WHERE -129 < colA; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE -129 >= colA; colA SELECT * FROM tinytbls WHERE -128 >= colA; colA -128 SELECT * FROM tinytbls WHERE -128 <= colA; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE -128 < colA; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE 128 = colA; colA SELECT * FROM tinytbls WHERE 128 <=> colA; colA SELECT * FROM tinytbls WHERE 128 <> colA; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE 127 = colA; colA 127 SELECT * FROM tinytbls WHERE 127 <=> colA; colA 127 SELECT * FROM tinytbls WHERE 127 <> colA; colA -128 -127 0 1 3 126 0 SELECT * FROM tinytbls WHERE -128 = colA; colA -128 SELECT * FROM tinytbls WHERE -128 <=> colA; colA -128 SELECT * FROM tinytbls WHERE -128 <> colA; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE -129 = colA; colA SELECT * FROM tinytbls WHERE -129 <=> colA; colA SELECT * FROM tinytbls WHERE -129 <> colA; colA -128 -127 0 1 3 126 127 0 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM tinytbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM tinytbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_gret_eq USING @maxint; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 127 EXECUTE p_less USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -128 EXECUTE p_less_eq USING @minint; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_eq USING @maxint; colA 127 EXECUTE p_equal USING @maxint; colA 127 EXECUTE p_n_eq USING @maxint; colA -128 -127 0 1 3 126 0 EXECUTE p_n_equal USING @maxint; colA -128 -127 0 1 3 126 0 EXECUTE p_eq USING @minint; colA -128 EXECUTE p_equal USING @minint; colA -128 EXECUTE p_n_eq USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @minint; colA -127 0 1 3 126 127 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 EXECUTE p_n_equal USING @minint_minus_1; colA -128 -127 0 1 3 126 127 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM tinytbls WHERE 128 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE 127 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE 128 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 127 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 = `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 127 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE -129 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -128 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) = `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE -128 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) < `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 128 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 128 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE 128 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true EXPLAIN SELECT * FROM tinytbls WHERE 127 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = 127) EXPLAIN SELECT * FROM tinytbls WHERE 127 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 <=> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE 127 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (127 <> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (`test`.`tinytbls`.`colA` = <cache>(-(128))) EXPLAIN SELECT * FROM tinytbls WHERE -128 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) <=> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -128 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where (<cache>(-(128)) <> `test`.`tinytbls`.`colA`) EXPLAIN SELECT * FROM tinytbls WHERE -129 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where false EXPLAIN SELECT * FROM tinytbls WHERE -129 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tinytbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`tinytbls`.`colA` AS `colA` from `test`.`tinytbls` where true DROP TABLE tinytbls; # # Tests with type TINYINT NOT NULL against decimal # CREATE TABLE tinytbls (colA TINYINT NOT NULL); INSERT INTO tinytbls VALUES (-128), (-127), (0),(1),(3), (126), (127), (0); ANALYZE TABLE tinytbls; Table Op Msg_type Msg_text test.tinytbls analyze status OK SELECT * FROM tinytbls; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < 0.5; colA -128 -127 0 0 SELECT * FROM tinytbls WHERE colA <= 0.5; colA -128 -127 0 0 SELECT * FROM tinytbls WHERE colA > 0.5; colA 1 3 126 127 SELECT * FROM tinytbls WHERE colA >= 0.5; colA 1 3 126 127 SELECT * FROM tinytbls WHERE colA = 0.5; colA SELECT * FROM tinytbls WHERE colA <> 0.5; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < -0.5; colA -128 -127 SELECT * FROM tinytbls WHERE colA <= -0.5; colA -128 -127 SELECT * FROM tinytbls WHERE colA > -0.5; colA 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA >= -0.5; colA 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = -0.5; colA SELECT * FROM tinytbls WHERE colA <> -0.5; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < 127.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <= 127.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA > 127.00001; colA SELECT * FROM tinytbls WHERE colA >= 127.00001; colA SELECT * FROM tinytbls WHERE colA = 127.00001; colA SELECT * FROM tinytbls WHERE colA <> 127.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < 126.99999; colA -128 -127 0 1 3 126 0 SELECT * FROM tinytbls WHERE colA <= 126.99999; colA -128 -127 0 1 3 126 0 SELECT * FROM tinytbls WHERE colA > 126.99999; colA 127 SELECT * FROM tinytbls WHERE colA >= 126.99999; colA 127 SELECT * FROM tinytbls WHERE colA = 126.99999; colA SELECT * FROM tinytbls WHERE colA <> 126.99999; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < -127.99999; colA -128 SELECT * FROM tinytbls WHERE colA <= -127.99999; colA -128 SELECT * FROM tinytbls WHERE colA > -127.99999; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA >= -127.99999; colA -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = -127.99999; colA SELECT * FROM tinytbls WHERE colA <> -127.99999; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < -128.00001; colA SELECT * FROM tinytbls WHERE colA <= -128.00001; colA SELECT * FROM tinytbls WHERE colA > -128.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA >= -128.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = -128.00001; colA SELECT * FROM tinytbls WHERE colA <> -128.00001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA <= 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM tinytbls WHERE colA <> 18446744073709551615.00000001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA > -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA >= -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 0 SELECT * FROM tinytbls WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM tinytbls WHERE colA <> -9223372036854775808.00000001; colA -128 -127 0 1 3 126 127 0 PREPARE p_less FROM 'SELECT * FROM tinytbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM tinytbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM tinytbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM tinytbls WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM tinytbls WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM tinytbls WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=127.00001; SET @dec_max_minus_delta=126.99999; SET @dec_min_plus_delta=-127.99999; SET @dec_min_minus_delta=-128.00001; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA -128 -127 0 0 EXECUTE p_less_eq USING @dec_0_5; colA -128 -127 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 3 126 127 EXECUTE p_gret_eq USING @dec_0_5; colA 1 3 126 127 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_minus_0_5; colA -128 -127 EXECUTE p_less_eq USING @dec_minus_0_5; colA -128 -127 EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 3 126 127 0 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 3 126 127 0 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less_eq USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 0 EXECUTE p_less_eq USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 0 EXECUTE p_greater USING @dec_max_minus_delta; colA 127 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 127 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_min_plus_delta; colA -128 EXECUTE p_less_eq USING @dec_min_plus_delta; colA -128 EXECUTE p_greater USING @dec_min_plus_delta; colA -127 0 1 3 126 127 0 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA -127 0 1 3 126 127 0 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 0 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA -128 -127 0 1 3 126 127 0 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 0 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 0 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA -128 -127 0 1 3 126 127 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE tinytbls; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type SMALLINT against int # CREATE TABLE smalltbl (colA SMALLINT UNSIGNED ); INSERT INTO smalltbl VALUES (0), (1), (0),(1),(3), (65534), (65535), (NULL); ANALYZE TABLE smalltbl; Table Op Msg_type Msg_text test.smalltbl analyze status OK SELECT * FROM smalltbl; colA 0 1 0 1 3 65534 65535 NULL SELECT * FROM smalltbl WHERE colA < 65536; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA <= 65535; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA > 65536; colA SELECT * FROM smalltbl WHERE colA >= 65535; colA 65535 SELECT * FROM smalltbl WHERE colA > -1; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA <= -1; colA SELECT * FROM smalltbl WHERE colA <= 0; colA 0 0 SELECT * FROM smalltbl WHERE colA >= 0; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA > 0; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 65536; colA SELECT * FROM smalltbl WHERE colA <> 65536; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 65535; colA 65535 SELECT * FROM smalltbl WHERE colA <=> 65535; colA 65535 SELECT * FROM smalltbl WHERE NOT(colA <=> 65535); colA 0 1 0 1 3 65534 NULL SELECT * FROM smalltbl WHERE colA <> 65535; colA 0 1 0 1 3 65534 SELECT * FROM smalltbl WHERE colA = 0; colA 0 0 SELECT * FROM smalltbl WHERE colA <=> 0; colA 0 0 SELECT * FROM smalltbl WHERE NOT(colA <=> 0); colA 1 1 3 65534 65535 NULL SELECT * FROM smalltbl WHERE colA <> 0; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = -1; colA SELECT * FROM smalltbl WHERE colA <=> -1; colA SELECT * FROM smalltbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 65534 65535 NULL SELECT * FROM smalltbl WHERE colA <> -1; colA 0 1 0 1 3 65534 65535 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM smalltbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbl WHERE colA <> ?'; SET @maxint_plus_1=65536; SET @maxint=65535; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 65534 65535 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 65535 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 65534 65535 EXECUTE p_greater USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 NULL EXECUTE p_eq USING @maxint; colA 65535 EXECUTE p_equal USING @maxint; colA 65535 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 65534 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 65534 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 65534 65535 EXECUTE p_n_equal USING @minint; colA 1 1 3 65534 65535 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbl WHERE colA < 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE colA <= 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE colA > 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA >= 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` > 0) EXPLAIN SELECT * FROM smalltbl WHERE colA = 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <> 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE colA = 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <=> 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA <> 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <> 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <=> 0) EXPLAIN SELECT * FROM smalltbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <> 0) EXPLAIN SELECT * FROM smalltbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) same queries but constant first SELECT * FROM smalltbl WHERE 65536 > colA; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE 65535 >= colA; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE 65536 < colA; colA SELECT * FROM smalltbl WHERE 65535 <= colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 < colA; colA SELECT * FROM smalltbl WHERE -1 < colA; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE -1 >= colA; colA SELECT * FROM smalltbl WHERE 0 >= colA; colA 0 0 SELECT * FROM smalltbl WHERE 0 <= colA; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE 0 < colA; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE 65536 = colA; colA SELECT * FROM smalltbl WHERE 65536 <=> colA; colA SELECT * FROM smalltbl WHERE 65536 <> colA; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE 65535 = colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 <=> colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 <> colA; colA 0 1 0 1 3 65534 SELECT * FROM smalltbl WHERE 0 = colA; colA 0 0 SELECT * FROM smalltbl WHERE 0 <=> colA; colA 0 0 SELECT * FROM smalltbl WHERE 0 <> colA; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE -1 = colA; colA SELECT * FROM smalltbl WHERE -1 <=> colA; colA SELECT * FROM smalltbl WHERE -1 <> colA; colA 0 1 0 1 3 65534 65535 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM smalltbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 65535 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 NULL EXECUTE p_eq USING @maxint; colA 65535 EXECUTE p_equal USING @maxint; colA 65535 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 65534 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 65534 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 65534 65535 EXECUTE p_n_equal USING @minint; colA 1 1 3 65534 65535 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbl WHERE 65536 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE 65535 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE 65536 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65535 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 = `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65535 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 = `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 < `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65536 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65536 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65536 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) EXPLAIN SELECT * FROM smalltbl WHERE 65535 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE 65535 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 <=> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65535 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 <> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 <=> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 <> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` is not null) DROP TABLE smalltbl; # # Tests with UNSIGNED type SMALLINT against decimal # CREATE TABLE smalltbl (colA SMALLINT UNSIGNED ); INSERT INTO smalltbl VALUES (0), (1), (0),(1),(3), (65534), (65535), (NULL); ANALYZE TABLE smalltbl; Table Op Msg_type Msg_text test.smalltbl analyze status OK SELECT * FROM smalltbl; colA 0 1 0 1 3 65534 65535 NULL SELECT * FROM smalltbl WHERE colA < 0.5; colA 0 0 SELECT * FROM smalltbl WHERE colA <= 0.5; colA 0 0 SELECT * FROM smalltbl WHERE colA > 0.5; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= 0.5; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 0.5; colA SELECT * FROM smalltbl WHERE colA <> 0.5; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < -0.5; colA SELECT * FROM smalltbl WHERE colA <= -0.5; colA SELECT * FROM smalltbl WHERE colA > -0.5; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= -0.5; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = -0.5; colA SELECT * FROM smalltbl WHERE colA <> -0.5; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < 65535.00001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA <= 65535.00001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA > 65535.00001; colA SELECT * FROM smalltbl WHERE colA >= 65535.00001; colA SELECT * FROM smalltbl WHERE colA = 65535.00001; colA SELECT * FROM smalltbl WHERE colA <> 65535.00001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < 65534.99999; colA 0 1 0 1 3 65534 SELECT * FROM smalltbl WHERE colA <= 65534.99999; colA 0 1 0 1 3 65534 SELECT * FROM smalltbl WHERE colA > 65534.99999; colA 65535 SELECT * FROM smalltbl WHERE colA >= 65534.99999; colA 65535 SELECT * FROM smalltbl WHERE colA = 65534.99999; colA SELECT * FROM smalltbl WHERE colA <> 65534.99999; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < 0.00001; colA 0 0 SELECT * FROM smalltbl WHERE colA <= 0.00001; colA 0 0 SELECT * FROM smalltbl WHERE colA > 0.00001; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= 0.00001; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 0.00001; colA SELECT * FROM smalltbl WHERE colA <> 0.00001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < -0.99999; colA SELECT * FROM smalltbl WHERE colA <= -0.99999; colA SELECT * FROM smalltbl WHERE colA > -0.99999; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= -0.99999; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = -0.99999; colA SELECT * FROM smalltbl WHERE colA <> -0.99999; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=65535.00001; SET @dec_max_minus_delta=65534.99999; SET @dec_min_plus_delta=0.00001; SET @dec_min_minus_delta=-0.99999; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 65534 65535 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 EXECUTE p_greater USING @dec_max_minus_delta; colA 65535 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 65535 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 65534 65535 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE smalltbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type SMALLINT NOT NULL against int # CREATE TABLE smalltbl (colA SMALLINT UNSIGNED NOT NULL); INSERT INTO smalltbl VALUES (0), (1), (0),(1),(3), (65534), (65535), (0); ANALYZE TABLE smalltbl; Table Op Msg_type Msg_text test.smalltbl analyze status OK SELECT * FROM smalltbl; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 65536; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA <= 65535; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA > 65536; colA SELECT * FROM smalltbl WHERE colA >= 65535; colA 65535 SELECT * FROM smalltbl WHERE colA > -1; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA <= -1; colA SELECT * FROM smalltbl WHERE colA <= 0; colA 0 0 0 SELECT * FROM smalltbl WHERE colA >= 0; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA > 0; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 65536; colA SELECT * FROM smalltbl WHERE colA <> 65536; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA = 65535; colA 65535 SELECT * FROM smalltbl WHERE colA <=> 65535; colA 65535 SELECT * FROM smalltbl WHERE NOT(colA <=> 65535); colA 0 1 0 1 3 65534 0 SELECT * FROM smalltbl WHERE colA <> 65535; colA 0 1 0 1 3 65534 0 SELECT * FROM smalltbl WHERE colA = 0; colA 0 0 0 SELECT * FROM smalltbl WHERE colA <=> 0; colA 0 0 0 SELECT * FROM smalltbl WHERE NOT(colA <=> 0); colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA <> 0; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = -1; colA SELECT * FROM smalltbl WHERE colA <=> -1; colA SELECT * FROM smalltbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA <> -1; colA 0 1 0 1 3 65534 65535 0 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM smalltbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbl WHERE colA <> ?'; SET @maxint_plus_1=65536; SET @maxint=65535; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 65535 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_greater USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_eq USING @maxint; colA 65535 EXECUTE p_equal USING @maxint; colA 65535 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 65534 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 65534 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 65534 65535 EXECUTE p_n_equal USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbl WHERE colA < 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE colA <= 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE colA > 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA >= 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` > 0) EXPLAIN SELECT * FROM smalltbl WHERE colA = 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <> 65536; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE colA = 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <=> 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA <> 65535; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <> 65535) EXPLAIN SELECT * FROM smalltbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <=> 0) EXPLAIN SELECT * FROM smalltbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` <> 0) EXPLAIN SELECT * FROM smalltbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true same queries but constant first SELECT * FROM smalltbl WHERE 65536 > colA; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE 65535 >= colA; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE 65536 < colA; colA SELECT * FROM smalltbl WHERE 65535 <= colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 < colA; colA SELECT * FROM smalltbl WHERE -1 < colA; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE -1 >= colA; colA SELECT * FROM smalltbl WHERE 0 >= colA; colA 0 0 0 SELECT * FROM smalltbl WHERE 0 <= colA; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE 0 < colA; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE 65536 = colA; colA SELECT * FROM smalltbl WHERE 65536 <=> colA; colA SELECT * FROM smalltbl WHERE 65536 <> colA; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE 65535 = colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 <=> colA; colA 65535 SELECT * FROM smalltbl WHERE 65535 <> colA; colA 0 1 0 1 3 65534 0 SELECT * FROM smalltbl WHERE 0 = colA; colA 0 0 0 SELECT * FROM smalltbl WHERE 0 <=> colA; colA 0 0 0 SELECT * FROM smalltbl WHERE 0 <> colA; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE -1 = colA; colA SELECT * FROM smalltbl WHERE -1 <=> colA; colA SELECT * FROM smalltbl WHERE -1 <> colA; colA 0 1 0 1 3 65534 65535 0 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM smalltbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 65535 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_eq USING @maxint; colA 65535 EXECUTE p_equal USING @maxint; colA 65535 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 65534 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 65534 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 65534 65535 EXECUTE p_n_equal USING @minint; colA 1 1 3 65534 65535 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 65534 65535 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbl WHERE 65536 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE 65535 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE 65536 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65535 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 = `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65535 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 = `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 < `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65536 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65536 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE 65536 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true EXPLAIN SELECT * FROM smalltbl WHERE 65535 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 65535) EXPLAIN SELECT * FROM smalltbl WHERE 65535 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 <=> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 65535 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (65535 <> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (`test`.`smalltbl`.`colA` = 0) EXPLAIN SELECT * FROM smalltbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 <=> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where (0 <> `test`.`smalltbl`.`colA`) EXPLAIN SELECT * FROM smalltbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where false EXPLAIN SELECT * FROM smalltbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbl`.`colA` AS `colA` from `test`.`smalltbl` where true DROP TABLE smalltbl; # # Tests with UNSIGNED type SMALLINT NOT NULL against decimal # CREATE TABLE smalltbl (colA SMALLINT UNSIGNED NOT NULL); INSERT INTO smalltbl VALUES (0), (1), (0),(1),(3), (65534), (65535), (0); ANALYZE TABLE smalltbl; Table Op Msg_type Msg_text test.smalltbl analyze status OK SELECT * FROM smalltbl; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 0.5; colA 0 0 0 SELECT * FROM smalltbl WHERE colA <= 0.5; colA 0 0 0 SELECT * FROM smalltbl WHERE colA > 0.5; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= 0.5; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 0.5; colA SELECT * FROM smalltbl WHERE colA <> 0.5; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < -0.5; colA SELECT * FROM smalltbl WHERE colA <= -0.5; colA SELECT * FROM smalltbl WHERE colA > -0.5; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA >= -0.5; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA = -0.5; colA SELECT * FROM smalltbl WHERE colA <> -0.5; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 65535.00001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA <= 65535.00001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA > 65535.00001; colA SELECT * FROM smalltbl WHERE colA >= 65535.00001; colA SELECT * FROM smalltbl WHERE colA = 65535.00001; colA SELECT * FROM smalltbl WHERE colA <> 65535.00001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 65534.99999; colA 0 1 0 1 3 65534 0 SELECT * FROM smalltbl WHERE colA <= 65534.99999; colA 0 1 0 1 3 65534 0 SELECT * FROM smalltbl WHERE colA > 65534.99999; colA 65535 SELECT * FROM smalltbl WHERE colA >= 65534.99999; colA 65535 SELECT * FROM smalltbl WHERE colA = 65534.99999; colA SELECT * FROM smalltbl WHERE colA <> 65534.99999; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 0.00001; colA 0 0 0 SELECT * FROM smalltbl WHERE colA <= 0.00001; colA 0 0 0 SELECT * FROM smalltbl WHERE colA > 0.00001; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA >= 0.00001; colA 1 1 3 65534 65535 SELECT * FROM smalltbl WHERE colA = 0.00001; colA SELECT * FROM smalltbl WHERE colA <> 0.00001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < -0.99999; colA SELECT * FROM smalltbl WHERE colA <= -0.99999; colA SELECT * FROM smalltbl WHERE colA > -0.99999; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA >= -0.99999; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA = -0.99999; colA SELECT * FROM smalltbl WHERE colA <> -0.99999; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM smalltbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 0 SELECT * FROM smalltbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM smalltbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 65534 65535 0 PREPARE p_less FROM 'SELECT * FROM smalltbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=65535.00001; SET @dec_max_minus_delta=65534.99999; SET @dec_min_plus_delta=0.00001; SET @dec_min_minus_delta=-0.99999; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 65534 65535 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 0 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 0 EXECUTE p_greater USING @dec_max_minus_delta; colA 65535 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 65535 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 65534 65535 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 65534 65535 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 0 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 65534 65535 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE smalltbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with type SMALLINT against int # CREATE TABLE smalltbls (colA SMALLINT ); INSERT INTO smalltbls VALUES (-32768), (-32767), (0),(1),(3), (32766), (32767), (NULL); ANALYZE TABLE smalltbls; Table Op Msg_type Msg_text test.smalltbls analyze status OK SELECT * FROM smalltbls; colA -32768 -32767 0 1 3 32766 32767 NULL SELECT * FROM smalltbls WHERE colA < 32768; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA <= 32767; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA > 32768; colA SELECT * FROM smalltbls WHERE colA >= 32767; colA 32767 SELECT * FROM smalltbls WHERE colA > -32769; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA <= -32769; colA SELECT * FROM smalltbls WHERE colA <= -32768; colA -32768 SELECT * FROM smalltbls WHERE colA >= -32768; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA > -32768; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = 32768; colA SELECT * FROM smalltbls WHERE colA <> 32768; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = 32767; colA 32767 SELECT * FROM smalltbls WHERE colA <=> 32767; colA 32767 SELECT * FROM smalltbls WHERE NOT(colA <=> 32767); colA -32768 -32767 0 1 3 32766 NULL SELECT * FROM smalltbls WHERE colA <> 32767; colA -32768 -32767 0 1 3 32766 SELECT * FROM smalltbls WHERE colA = -32768; colA -32768 SELECT * FROM smalltbls WHERE colA <=> -32768; colA -32768 SELECT * FROM smalltbls WHERE NOT(colA <=> -32768); colA -32767 0 1 3 32766 32767 NULL SELECT * FROM smalltbls WHERE colA <> -32768; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = -32769; colA SELECT * FROM smalltbls WHERE colA <=> -32769; colA SELECT * FROM smalltbls WHERE NOT(colA <=> -32769); colA -32768 -32767 0 1 3 32766 32767 NULL SELECT * FROM smalltbls WHERE colA <> -32769; colA -32768 -32767 0 1 3 32766 32767 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM smalltbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbls WHERE colA <> ?'; SET @maxint_plus_1=32768; SET @maxint=32767; SET @minint_minus_1=-32769; SET @minint=-32768; EXECUTE p_less USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less_eq USING @maxint; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 32767 EXECUTE p_greater USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -32768 EXECUTE p_gret_eq USING @minint; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_greater USING @minint; colA -32767 0 1 3 32766 32767 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 NULL EXECUTE p_eq USING @maxint; colA 32767 EXECUTE p_equal USING @maxint; colA 32767 EXECUTE p_n_eq USING @maxint; colA -32768 -32767 0 1 3 32766 EXECUTE p_n_equal USING @maxint; colA -32768 -32767 0 1 3 32766 NULL EXECUTE p_eq USING @minint; colA -32768 EXECUTE p_equal USING @minint; colA -32768 EXECUTE p_n_eq USING @minint; colA -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @minint; colA -32767 0 1 3 32766 32767 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbls WHERE colA < 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE colA <= 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE colA > 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA >= 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA > -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE colA <= -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <= -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA >= -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE colA > -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` > <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA = 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <=> 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <> 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE colA = 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA <=> 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <=> 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA <> 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <> 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA = -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA <=> -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <=> <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA <> -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <> <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA = -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <=> -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <> -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) same queries but constant first SELECT * FROM smalltbls WHERE 32768 > colA; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE 32767 >= colA; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE 32768 < colA; colA SELECT * FROM smalltbls WHERE 32767 <= colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 < colA; colA SELECT * FROM smalltbls WHERE -32769 < colA; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE -32769 >= colA; colA SELECT * FROM smalltbls WHERE -32768 >= colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <= colA; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE -32768 < colA; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE 32768 = colA; colA SELECT * FROM smalltbls WHERE 32768 <=> colA; colA SELECT * FROM smalltbls WHERE 32768 <> colA; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE 32767 = colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 <=> colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 <> colA; colA -32768 -32767 0 1 3 32766 SELECT * FROM smalltbls WHERE -32768 = colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <=> colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <> colA; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE -32769 = colA; colA SELECT * FROM smalltbls WHERE -32769 <=> colA; colA SELECT * FROM smalltbls WHERE -32769 <> colA; colA -32768 -32767 0 1 3 32766 32767 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM smalltbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_gret_eq USING @maxint; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 32767 EXECUTE p_less USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -32768 EXECUTE p_less_eq USING @minint; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @minint; colA -32767 0 1 3 32766 32767 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 NULL EXECUTE p_eq USING @maxint; colA 32767 EXECUTE p_equal USING @maxint; colA 32767 EXECUTE p_n_eq USING @maxint; colA -32768 -32767 0 1 3 32766 EXECUTE p_n_equal USING @maxint; colA -32768 -32767 0 1 3 32766 NULL EXECUTE p_eq USING @minint; colA -32768 EXECUTE p_equal USING @minint; colA -32768 EXECUTE p_n_eq USING @minint; colA -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @minint; colA -32767 0 1 3 32766 32767 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_n_equal USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbls WHERE 32768 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE 32767 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE 32768 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32767 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 = `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32767 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE -32769 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32768 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) = `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE -32768 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) < `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32768 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32768 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32768 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) EXPLAIN SELECT * FROM smalltbls WHERE 32767 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE 32767 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 <=> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32767 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 <> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) <=> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) <> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32769 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` is not null) DROP TABLE smalltbls; # # Tests with type SMALLINT against decimal # CREATE TABLE smalltbls (colA SMALLINT ); INSERT INTO smalltbls VALUES (-32768), (-32767), (0),(1),(3), (32766), (32767), (NULL); ANALYZE TABLE smalltbls; Table Op Msg_type Msg_text test.smalltbls analyze status OK SELECT * FROM smalltbls; colA -32768 -32767 0 1 3 32766 32767 NULL SELECT * FROM smalltbls WHERE colA < 0.5; colA -32768 -32767 0 SELECT * FROM smalltbls WHERE colA <= 0.5; colA -32768 -32767 0 SELECT * FROM smalltbls WHERE colA > 0.5; colA 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= 0.5; colA 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = 0.5; colA SELECT * FROM smalltbls WHERE colA <> 0.5; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < -0.5; colA -32768 -32767 SELECT * FROM smalltbls WHERE colA <= -0.5; colA -32768 -32767 SELECT * FROM smalltbls WHERE colA > -0.5; colA 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= -0.5; colA 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = -0.5; colA SELECT * FROM smalltbls WHERE colA <> -0.5; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < 32767.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA <= 32767.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA > 32767.00001; colA SELECT * FROM smalltbls WHERE colA >= 32767.00001; colA SELECT * FROM smalltbls WHERE colA = 32767.00001; colA SELECT * FROM smalltbls WHERE colA <> 32767.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < 32766.99999; colA -32768 -32767 0 1 3 32766 SELECT * FROM smalltbls WHERE colA <= 32766.99999; colA -32768 -32767 0 1 3 32766 SELECT * FROM smalltbls WHERE colA > 32766.99999; colA 32767 SELECT * FROM smalltbls WHERE colA >= 32766.99999; colA 32767 SELECT * FROM smalltbls WHERE colA = 32766.99999; colA SELECT * FROM smalltbls WHERE colA <> 32766.99999; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < -32767.99999; colA -32768 SELECT * FROM smalltbls WHERE colA <= -32767.99999; colA -32768 SELECT * FROM smalltbls WHERE colA > -32767.99999; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= -32767.99999; colA -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = -32767.99999; colA SELECT * FROM smalltbls WHERE colA <> -32767.99999; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < -32768.00001; colA SELECT * FROM smalltbls WHERE colA <= -32768.00001; colA SELECT * FROM smalltbls WHERE colA > -32768.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= -32768.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = -32768.00001; colA SELECT * FROM smalltbls WHERE colA <> -32768.00001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA <= 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA <> 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA > -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA <> -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=32767.00001; SET @dec_max_minus_delta=32766.99999; SET @dec_min_plus_delta=-32767.99999; SET @dec_min_minus_delta=-32768.00001; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA -32768 -32767 0 EXECUTE p_less_eq USING @dec_0_5; colA -32768 -32767 0 EXECUTE p_greater USING @dec_0_5; colA 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_0_5; colA 1 3 32766 32767 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_minus_0_5; colA -32768 -32767 EXECUTE p_less_eq USING @dec_minus_0_5; colA -32768 -32767 EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 3 32766 32767 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less_eq USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 EXECUTE p_less_eq USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 EXECUTE p_greater USING @dec_max_minus_delta; colA 32767 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 32767 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_min_plus_delta; colA -32768 EXECUTE p_less_eq USING @dec_min_plus_delta; colA -32768 EXECUTE p_greater USING @dec_min_plus_delta; colA -32767 0 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA -32767 0 1 3 32766 32767 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE smalltbls; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with type SMALLINT NOT NULL against int # CREATE TABLE smalltbls (colA SMALLINT NOT NULL); INSERT INTO smalltbls VALUES (-32768), (-32767), (0),(1),(3), (32766), (32767), (0); ANALYZE TABLE smalltbls; Table Op Msg_type Msg_text test.smalltbls analyze status OK SELECT * FROM smalltbls; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < 32768; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <= 32767; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA > 32768; colA SELECT * FROM smalltbls WHERE colA >= 32767; colA 32767 SELECT * FROM smalltbls WHERE colA > -32769; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <= -32769; colA SELECT * FROM smalltbls WHERE colA <= -32768; colA -32768 SELECT * FROM smalltbls WHERE colA >= -32768; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA > -32768; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = 32768; colA SELECT * FROM smalltbls WHERE colA <> 32768; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = 32767; colA 32767 SELECT * FROM smalltbls WHERE colA <=> 32767; colA 32767 SELECT * FROM smalltbls WHERE NOT(colA <=> 32767); colA -32768 -32767 0 1 3 32766 0 SELECT * FROM smalltbls WHERE colA <> 32767; colA -32768 -32767 0 1 3 32766 0 SELECT * FROM smalltbls WHERE colA = -32768; colA -32768 SELECT * FROM smalltbls WHERE colA <=> -32768; colA -32768 SELECT * FROM smalltbls WHERE NOT(colA <=> -32768); colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <> -32768; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = -32769; colA SELECT * FROM smalltbls WHERE colA <=> -32769; colA SELECT * FROM smalltbls WHERE NOT(colA <=> -32769); colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <> -32769; colA -32768 -32767 0 1 3 32766 32767 0 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM smalltbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbls WHERE colA <> ?'; SET @maxint_plus_1=32768; SET @maxint=32767; SET @minint_minus_1=-32769; SET @minint=-32768; EXECUTE p_less USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less_eq USING @maxint; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 32767 EXECUTE p_greater USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -32768 EXECUTE p_gret_eq USING @minint; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_greater USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @maxint; colA 32767 EXECUTE p_equal USING @maxint; colA 32767 EXECUTE p_n_eq USING @maxint; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_n_equal USING @maxint; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_eq USING @minint; colA -32768 EXECUTE p_equal USING @minint; colA -32768 EXECUTE p_n_eq USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbls WHERE colA < 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE colA <= 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE colA > 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA >= 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA > -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE colA <= -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <= -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA >= -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE colA > -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` > <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA = 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <=> 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <> 32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE colA = 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA <=> 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <=> 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA <> 32767; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <> 32767) EXPLAIN SELECT * FROM smalltbls WHERE colA = -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA <=> -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <=> <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA <> -32768; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` <> <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE colA = -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <=> -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE colA <> -32769; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true same queries but constant first SELECT * FROM smalltbls WHERE 32768 > colA; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE 32767 >= colA; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE 32768 < colA; colA SELECT * FROM smalltbls WHERE 32767 <= colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 < colA; colA SELECT * FROM smalltbls WHERE -32769 < colA; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE -32769 >= colA; colA SELECT * FROM smalltbls WHERE -32768 >= colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <= colA; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE -32768 < colA; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE 32768 = colA; colA SELECT * FROM smalltbls WHERE 32768 <=> colA; colA SELECT * FROM smalltbls WHERE 32768 <> colA; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE 32767 = colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 <=> colA; colA 32767 SELECT * FROM smalltbls WHERE 32767 <> colA; colA -32768 -32767 0 1 3 32766 0 SELECT * FROM smalltbls WHERE -32768 = colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <=> colA; colA -32768 SELECT * FROM smalltbls WHERE -32768 <> colA; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE -32769 = colA; colA SELECT * FROM smalltbls WHERE -32769 <=> colA; colA SELECT * FROM smalltbls WHERE -32769 <> colA; colA -32768 -32767 0 1 3 32766 32767 0 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM smalltbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM smalltbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @maxint; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 32767 EXECUTE p_less USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -32768 EXECUTE p_less_eq USING @minint; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @maxint; colA 32767 EXECUTE p_equal USING @maxint; colA 32767 EXECUTE p_n_eq USING @maxint; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_n_equal USING @maxint; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_eq USING @minint; colA -32768 EXECUTE p_equal USING @minint; colA -32768 EXECUTE p_n_eq USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @minint; colA -32767 0 1 3 32766 32767 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_n_equal USING @minint_minus_1; colA -32768 -32767 0 1 3 32766 32767 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM smalltbls WHERE 32768 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE 32767 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE 32768 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32767 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 = `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32767 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE -32769 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32768 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) = `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE -32768 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) < `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32768 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32768 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE 32768 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true EXPLAIN SELECT * FROM smalltbls WHERE 32767 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = 32767) EXPLAIN SELECT * FROM smalltbls WHERE 32767 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 <=> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE 32767 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (32767 <> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (`test`.`smalltbls`.`colA` = <cache>(-(32768))) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) <=> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32768 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where (<cache>(-(32768)) <> `test`.`smalltbls`.`colA`) EXPLAIN SELECT * FROM smalltbls WHERE -32769 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where false EXPLAIN SELECT * FROM smalltbls WHERE -32769 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE smalltbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`smalltbls`.`colA` AS `colA` from `test`.`smalltbls` where true DROP TABLE smalltbls; # # Tests with type SMALLINT NOT NULL against decimal # CREATE TABLE smalltbls (colA SMALLINT NOT NULL); INSERT INTO smalltbls VALUES (-32768), (-32767), (0),(1),(3), (32766), (32767), (0); ANALYZE TABLE smalltbls; Table Op Msg_type Msg_text test.smalltbls analyze status OK SELECT * FROM smalltbls; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < 0.5; colA -32768 -32767 0 0 SELECT * FROM smalltbls WHERE colA <= 0.5; colA -32768 -32767 0 0 SELECT * FROM smalltbls WHERE colA > 0.5; colA 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA >= 0.5; colA 1 3 32766 32767 SELECT * FROM smalltbls WHERE colA = 0.5; colA SELECT * FROM smalltbls WHERE colA <> 0.5; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < -0.5; colA -32768 -32767 SELECT * FROM smalltbls WHERE colA <= -0.5; colA -32768 -32767 SELECT * FROM smalltbls WHERE colA > -0.5; colA 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA >= -0.5; colA 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = -0.5; colA SELECT * FROM smalltbls WHERE colA <> -0.5; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < 32767.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <= 32767.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA > 32767.00001; colA SELECT * FROM smalltbls WHERE colA >= 32767.00001; colA SELECT * FROM smalltbls WHERE colA = 32767.00001; colA SELECT * FROM smalltbls WHERE colA <> 32767.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < 32766.99999; colA -32768 -32767 0 1 3 32766 0 SELECT * FROM smalltbls WHERE colA <= 32766.99999; colA -32768 -32767 0 1 3 32766 0 SELECT * FROM smalltbls WHERE colA > 32766.99999; colA 32767 SELECT * FROM smalltbls WHERE colA >= 32766.99999; colA 32767 SELECT * FROM smalltbls WHERE colA = 32766.99999; colA SELECT * FROM smalltbls WHERE colA <> 32766.99999; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < -32767.99999; colA -32768 SELECT * FROM smalltbls WHERE colA <= -32767.99999; colA -32768 SELECT * FROM smalltbls WHERE colA > -32767.99999; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA >= -32767.99999; colA -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = -32767.99999; colA SELECT * FROM smalltbls WHERE colA <> -32767.99999; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < -32768.00001; colA SELECT * FROM smalltbls WHERE colA <= -32768.00001; colA SELECT * FROM smalltbls WHERE colA > -32768.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA >= -32768.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = -32768.00001; colA SELECT * FROM smalltbls WHERE colA <> -32768.00001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA <= 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM smalltbls WHERE colA <> 18446744073709551615.00000001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA > -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA >= -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 0 SELECT * FROM smalltbls WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM smalltbls WHERE colA <> -9223372036854775808.00000001; colA -32768 -32767 0 1 3 32766 32767 0 PREPARE p_less FROM 'SELECT * FROM smalltbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM smalltbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM smalltbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM smalltbls WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM smalltbls WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM smalltbls WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=32767.00001; SET @dec_max_minus_delta=32766.99999; SET @dec_min_plus_delta=-32767.99999; SET @dec_min_minus_delta=-32768.00001; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA -32768 -32767 0 0 EXECUTE p_less_eq USING @dec_0_5; colA -32768 -32767 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 3 32766 32767 EXECUTE p_gret_eq USING @dec_0_5; colA 1 3 32766 32767 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_minus_0_5; colA -32768 -32767 EXECUTE p_less_eq USING @dec_minus_0_5; colA -32768 -32767 EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 3 32766 32767 0 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less_eq USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_less_eq USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 0 EXECUTE p_greater USING @dec_max_minus_delta; colA 32767 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 32767 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_min_plus_delta; colA -32768 EXECUTE p_less_eq USING @dec_min_plus_delta; colA -32768 EXECUTE p_greater USING @dec_min_plus_delta; colA -32767 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA -32767 0 1 3 32766 32767 0 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA -32768 -32767 0 1 3 32766 32767 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE smalltbls; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type MEDIUMINT against int # CREATE TABLE mediumtbl (colA MEDIUMINT UNSIGNED ); INSERT INTO mediumtbl VALUES (0), (1), (0),(1),(3), (16777214), (16777215), (NULL); ANALYZE TABLE mediumtbl; Table Op Msg_type Msg_text test.mediumtbl analyze status OK SELECT * FROM mediumtbl; colA 0 1 0 1 3 16777214 16777215 NULL SELECT * FROM mediumtbl WHERE colA < 16777216; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA <= 16777215; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA > 16777216; colA SELECT * FROM mediumtbl WHERE colA >= 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE colA > -1; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA <= -1; colA SELECT * FROM mediumtbl WHERE colA <= 0; colA 0 0 SELECT * FROM mediumtbl WHERE colA >= 0; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA > 0; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA = 16777216; colA SELECT * FROM mediumtbl WHERE colA <> 16777216; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA = 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE colA <=> 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE NOT(colA <=> 16777215); colA 0 1 0 1 3 16777214 NULL SELECT * FROM mediumtbl WHERE colA <> 16777215; colA 0 1 0 1 3 16777214 SELECT * FROM mediumtbl WHERE colA = 0; colA 0 0 SELECT * FROM mediumtbl WHERE colA <=> 0; colA 0 0 SELECT * FROM mediumtbl WHERE NOT(colA <=> 0); colA 1 1 3 16777214 16777215 NULL SELECT * FROM mediumtbl WHERE colA <> 0; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA = -1; colA SELECT * FROM mediumtbl WHERE colA <=> -1; colA SELECT * FROM mediumtbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 16777214 16777215 NULL SELECT * FROM mediumtbl WHERE colA <> -1; colA 0 1 0 1 3 16777214 16777215 PREPARE p_less FROM 'SELECT * FROM mediumtbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM mediumtbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM mediumtbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM mediumtbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbl WHERE colA <> ?'; SET @maxint_plus_1=16777216; SET @maxint=16777215; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 16777215 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_greater USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 NULL EXECUTE p_eq USING @maxint; colA 16777215 EXECUTE p_equal USING @maxint; colA 16777215 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 16777214 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 16777214 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint; colA 1 1 3 16777214 16777215 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbl WHERE colA < 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE colA <= 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE colA > 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA >= 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` > 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA = 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE colA = 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <=> 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <> 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <=> 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <> 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) same queries but constant first SELECT * FROM mediumtbl WHERE 16777216 > colA; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 16777215 >= colA; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 16777216 < colA; colA SELECT * FROM mediumtbl WHERE 16777215 <= colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 < colA; colA SELECT * FROM mediumtbl WHERE -1 < colA; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE -1 >= colA; colA SELECT * FROM mediumtbl WHERE 0 >= colA; colA 0 0 SELECT * FROM mediumtbl WHERE 0 <= colA; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 0 < colA; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 16777216 = colA; colA SELECT * FROM mediumtbl WHERE 16777216 <=> colA; colA SELECT * FROM mediumtbl WHERE 16777216 <> colA; colA 0 1 0 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 16777215 = colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 <=> colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 <> colA; colA 0 1 0 1 3 16777214 SELECT * FROM mediumtbl WHERE 0 = colA; colA 0 0 SELECT * FROM mediumtbl WHERE 0 <=> colA; colA 0 0 SELECT * FROM mediumtbl WHERE 0 <> colA; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE -1 = colA; colA SELECT * FROM mediumtbl WHERE -1 <=> colA; colA SELECT * FROM mediumtbl WHERE -1 <> colA; colA 0 1 0 1 3 16777214 16777215 PREPARE p_less FROM 'SELECT * FROM mediumtbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM mediumtbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM mediumtbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM mediumtbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 16777215 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_less USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 NULL EXECUTE p_eq USING @maxint; colA 16777215 EXECUTE p_equal USING @maxint; colA 16777215 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 16777214 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 16777214 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint; colA 1 1 3 16777214 16777215 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 = `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 = `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 < `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 <=> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 <> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 <=> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 <> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` is not null) DROP TABLE mediumtbl; # # Tests with UNSIGNED type MEDIUMINT NOT NULL against int # CREATE TABLE mediumtbl (colA MEDIUMINT UNSIGNED NOT NULL); INSERT INTO mediumtbl VALUES (0), (1), (0),(1),(3), (16777214), (16777215), (0); ANALYZE TABLE mediumtbl; Table Op Msg_type Msg_text test.mediumtbl analyze status OK SELECT * FROM mediumtbl; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA < 16777216; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA <= 16777215; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA > 16777216; colA SELECT * FROM mediumtbl WHERE colA >= 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE colA > -1; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA <= -1; colA SELECT * FROM mediumtbl WHERE colA <= 0; colA 0 0 0 SELECT * FROM mediumtbl WHERE colA >= 0; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA > 0; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA = 16777216; colA SELECT * FROM mediumtbl WHERE colA <> 16777216; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA = 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE colA <=> 16777215; colA 16777215 SELECT * FROM mediumtbl WHERE NOT(colA <=> 16777215); colA 0 1 0 1 3 16777214 0 SELECT * FROM mediumtbl WHERE colA <> 16777215; colA 0 1 0 1 3 16777214 0 SELECT * FROM mediumtbl WHERE colA = 0; colA 0 0 0 SELECT * FROM mediumtbl WHERE colA <=> 0; colA 0 0 0 SELECT * FROM mediumtbl WHERE NOT(colA <=> 0); colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA <> 0; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE colA = -1; colA SELECT * FROM mediumtbl WHERE colA <=> -1; colA SELECT * FROM mediumtbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE colA <> -1; colA 0 1 0 1 3 16777214 16777215 0 PREPARE p_less FROM 'SELECT * FROM mediumtbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM mediumtbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM mediumtbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM mediumtbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbl WHERE colA <> ?'; SET @maxint_plus_1=16777216; SET @maxint=16777215; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 16777215 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_greater USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_eq USING @maxint; colA 16777215 EXECUTE p_equal USING @maxint; colA 16777215 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 16777214 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 16777214 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbl WHERE colA < 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE colA <= 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE colA > 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA >= 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` > 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA = 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 16777216; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE colA = 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <=> 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 16777215; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <> 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <=> 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` <> 0) EXPLAIN SELECT * FROM mediumtbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true same queries but constant first SELECT * FROM mediumtbl WHERE 16777216 > colA; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE 16777215 >= colA; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE 16777216 < colA; colA SELECT * FROM mediumtbl WHERE 16777215 <= colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 < colA; colA SELECT * FROM mediumtbl WHERE -1 < colA; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE -1 >= colA; colA SELECT * FROM mediumtbl WHERE 0 >= colA; colA 0 0 0 SELECT * FROM mediumtbl WHERE 0 <= colA; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE 0 < colA; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE 16777216 = colA; colA SELECT * FROM mediumtbl WHERE 16777216 <=> colA; colA SELECT * FROM mediumtbl WHERE 16777216 <> colA; colA 0 1 0 1 3 16777214 16777215 0 SELECT * FROM mediumtbl WHERE 16777215 = colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 <=> colA; colA 16777215 SELECT * FROM mediumtbl WHERE 16777215 <> colA; colA 0 1 0 1 3 16777214 0 SELECT * FROM mediumtbl WHERE 0 = colA; colA 0 0 0 SELECT * FROM mediumtbl WHERE 0 <=> colA; colA 0 0 0 SELECT * FROM mediumtbl WHERE 0 <> colA; colA 1 1 3 16777214 16777215 SELECT * FROM mediumtbl WHERE -1 = colA; colA SELECT * FROM mediumtbl WHERE -1 <=> colA; colA SELECT * FROM mediumtbl WHERE -1 <> colA; colA 0 1 0 1 3 16777214 16777215 0 PREPARE p_less FROM 'SELECT * FROM mediumtbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM mediumtbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM mediumtbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM mediumtbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 16777215 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_less USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_eq USING @maxint; colA 16777215 EXECUTE p_equal USING @maxint; colA 16777215 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 16777214 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 16777214 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_n_equal USING @minint; colA 1 1 3 16777214 16777215 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 16777214 16777215 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 = `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 = `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 < `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE 16777216 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 16777215) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 <=> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 16777215 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (16777215 <> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (`test`.`mediumtbl`.`colA` = 0) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 <=> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where (0 <> `test`.`mediumtbl`.`colA`) EXPLAIN SELECT * FROM mediumtbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where false EXPLAIN SELECT * FROM mediumtbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbl`.`colA` AS `colA` from `test`.`mediumtbl` where true DROP TABLE mediumtbl; # # Tests with type MEDIUMINT against int # CREATE TABLE mediumtbls (colA MEDIUMINT ); INSERT INTO mediumtbls VALUES (-8388608), (-8388607), (0),(1),(3), (8388606), (8388607), (NULL); ANALYZE TABLE mediumtbls; Table Op Msg_type Msg_text test.mediumtbls analyze status OK SELECT * FROM mediumtbls; colA -8388608 -8388607 0 1 3 8388606 8388607 NULL SELECT * FROM mediumtbls WHERE colA < 8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA <= 8388607; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA > 8388608; colA SELECT * FROM mediumtbls WHERE colA >= 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE colA > -8388609; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA <= -8388609; colA SELECT * FROM mediumtbls WHERE colA <= -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE colA >= -8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA > -8388608; colA -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA = 8388608; colA SELECT * FROM mediumtbls WHERE colA <> 8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA = 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE colA <=> 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE NOT(colA <=> 8388607); colA -8388608 -8388607 0 1 3 8388606 NULL SELECT * FROM mediumtbls WHERE colA <> 8388607; colA -8388608 -8388607 0 1 3 8388606 SELECT * FROM mediumtbls WHERE colA = -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE colA <=> -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE NOT(colA <=> -8388608); colA -8388607 0 1 3 8388606 8388607 NULL SELECT * FROM mediumtbls WHERE colA <> -8388608; colA -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE colA = -8388609; colA SELECT * FROM mediumtbls WHERE colA <=> -8388609; colA SELECT * FROM mediumtbls WHERE NOT(colA <=> -8388609); colA -8388608 -8388607 0 1 3 8388606 8388607 NULL SELECT * FROM mediumtbls WHERE colA <> -8388609; colA -8388608 -8388607 0 1 3 8388606 8388607 PREPARE p_less FROM 'SELECT * FROM mediumtbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM mediumtbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM mediumtbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM mediumtbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbls WHERE colA <> ?'; SET @maxint_plus_1=8388608; SET @maxint=8388607; SET @minint_minus_1=-8388609; SET @minint=-8388608; EXECUTE p_less USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_less_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 8388607 EXECUTE p_greater USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -8388608 EXECUTE p_gret_eq USING @minint; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_greater USING @minint; colA -8388607 0 1 3 8388606 8388607 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 NULL EXECUTE p_eq USING @maxint; colA 8388607 EXECUTE p_equal USING @maxint; colA 8388607 EXECUTE p_n_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 EXECUTE p_n_equal USING @maxint; colA -8388608 -8388607 0 1 3 8388606 NULL EXECUTE p_eq USING @minint; colA -8388608 EXECUTE p_equal USING @minint; colA -8388608 EXECUTE p_n_eq USING @minint; colA -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @minint; colA -8388607 0 1 3 8388606 8388607 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbls WHERE colA < 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE colA <= 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE colA > 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA >= 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA > -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE colA <= -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <= -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA >= -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE colA > -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` > <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA = 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <> 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE colA = 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <=> 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA <> 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <> 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA = -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <=> <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA <> -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <> <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA = -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <> -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) same queries but constant first SELECT * FROM mediumtbls WHERE 8388608 > colA; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE 8388607 >= colA; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE 8388608 < colA; colA SELECT * FROM mediumtbls WHERE 8388607 <= colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 < colA; colA SELECT * FROM mediumtbls WHERE -8388609 < colA; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE -8388609 >= colA; colA SELECT * FROM mediumtbls WHERE -8388608 >= colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <= colA; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE -8388608 < colA; colA -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE 8388608 = colA; colA SELECT * FROM mediumtbls WHERE 8388608 <=> colA; colA SELECT * FROM mediumtbls WHERE 8388608 <> colA; colA -8388608 -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE 8388607 = colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 <=> colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 <> colA; colA -8388608 -8388607 0 1 3 8388606 SELECT * FROM mediumtbls WHERE -8388608 = colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <=> colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <> colA; colA -8388607 0 1 3 8388606 8388607 SELECT * FROM mediumtbls WHERE -8388609 = colA; colA SELECT * FROM mediumtbls WHERE -8388609 <=> colA; colA SELECT * FROM mediumtbls WHERE -8388609 <> colA; colA -8388608 -8388607 0 1 3 8388606 8388607 PREPARE p_less FROM 'SELECT * FROM mediumtbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM mediumtbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM mediumtbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM mediumtbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_gret_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 8388607 EXECUTE p_less USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -8388608 EXECUTE p_less_eq USING @minint; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_less USING @minint; colA -8388607 0 1 3 8388606 8388607 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 NULL EXECUTE p_eq USING @maxint; colA 8388607 EXECUTE p_equal USING @maxint; colA 8388607 EXECUTE p_n_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 EXECUTE p_n_equal USING @maxint; colA -8388608 -8388607 0 1 3 8388606 NULL EXECUTE p_eq USING @minint; colA -8388608 EXECUTE p_equal USING @minint; colA -8388608 EXECUTE p_n_eq USING @minint; colA -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @minint; colA -8388607 0 1 3 8388606 8388607 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 EXECUTE p_n_equal USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 = `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) = `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) < `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 <=> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 <> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) <=> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) <> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` is not null) DROP TABLE mediumtbls; # # Tests with type MEDIUMINT NOT NULL against int # CREATE TABLE mediumtbls (colA MEDIUMINT NOT NULL); INSERT INTO mediumtbls VALUES (-8388608), (-8388607), (0),(1),(3), (8388606), (8388607), (0); ANALYZE TABLE mediumtbls; Table Op Msg_type Msg_text test.mediumtbls analyze status OK SELECT * FROM mediumtbls; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA < 8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA <= 8388607; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA > 8388608; colA SELECT * FROM mediumtbls WHERE colA >= 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE colA > -8388609; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA <= -8388609; colA SELECT * FROM mediumtbls WHERE colA <= -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE colA >= -8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA > -8388608; colA -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA = 8388608; colA SELECT * FROM mediumtbls WHERE colA <> 8388608; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA = 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE colA <=> 8388607; colA 8388607 SELECT * FROM mediumtbls WHERE NOT(colA <=> 8388607); colA -8388608 -8388607 0 1 3 8388606 0 SELECT * FROM mediumtbls WHERE colA <> 8388607; colA -8388608 -8388607 0 1 3 8388606 0 SELECT * FROM mediumtbls WHERE colA = -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE colA <=> -8388608; colA -8388608 SELECT * FROM mediumtbls WHERE NOT(colA <=> -8388608); colA -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA <> -8388608; colA -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA = -8388609; colA SELECT * FROM mediumtbls WHERE colA <=> -8388609; colA SELECT * FROM mediumtbls WHERE NOT(colA <=> -8388609); colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE colA <> -8388609; colA -8388608 -8388607 0 1 3 8388606 8388607 0 PREPARE p_less FROM 'SELECT * FROM mediumtbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM mediumtbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM mediumtbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM mediumtbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbls WHERE colA <> ?'; SET @maxint_plus_1=8388608; SET @maxint=8388607; SET @minint_minus_1=-8388609; SET @minint=-8388608; EXECUTE p_less USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_less_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 8388607 EXECUTE p_greater USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -8388608 EXECUTE p_gret_eq USING @minint; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_greater USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @maxint; colA 8388607 EXECUTE p_equal USING @maxint; colA 8388607 EXECUTE p_n_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 0 EXECUTE p_n_equal USING @maxint; colA -8388608 -8388607 0 1 3 8388606 0 EXECUTE p_eq USING @minint; colA -8388608 EXECUTE p_equal USING @minint; colA -8388608 EXECUTE p_n_eq USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbls WHERE colA < 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE colA <= 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE colA > 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA >= 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA > -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE colA <= -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <= -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA >= -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE colA > -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` > <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA = 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <> 8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE colA = 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <=> 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA <> 8388607; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <> 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE colA = -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <=> <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA <> -8388608; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` <> <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE colA = -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <=> -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE colA <> -8388609; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true same queries but constant first SELECT * FROM mediumtbls WHERE 8388608 > colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE 8388607 >= colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE 8388608 < colA; colA SELECT * FROM mediumtbls WHERE 8388607 <= colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 < colA; colA SELECT * FROM mediumtbls WHERE -8388609 < colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE -8388609 >= colA; colA SELECT * FROM mediumtbls WHERE -8388608 >= colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <= colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE -8388608 < colA; colA -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE 8388608 = colA; colA SELECT * FROM mediumtbls WHERE 8388608 <=> colA; colA SELECT * FROM mediumtbls WHERE 8388608 <> colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE 8388607 = colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 <=> colA; colA 8388607 SELECT * FROM mediumtbls WHERE 8388607 <> colA; colA -8388608 -8388607 0 1 3 8388606 0 SELECT * FROM mediumtbls WHERE -8388608 = colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <=> colA; colA -8388608 SELECT * FROM mediumtbls WHERE -8388608 <> colA; colA -8388607 0 1 3 8388606 8388607 0 SELECT * FROM mediumtbls WHERE -8388609 = colA; colA SELECT * FROM mediumtbls WHERE -8388609 <=> colA; colA SELECT * FROM mediumtbls WHERE -8388609 <> colA; colA -8388608 -8388607 0 1 3 8388606 8388607 0 PREPARE p_less FROM 'SELECT * FROM mediumtbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM mediumtbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM mediumtbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM mediumtbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM mediumtbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM mediumtbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM mediumtbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM mediumtbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_gret_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 8388607 EXECUTE p_less USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -8388608 EXECUTE p_less_eq USING @minint; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_less USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @maxint; colA 8388607 EXECUTE p_equal USING @maxint; colA 8388607 EXECUTE p_n_eq USING @maxint; colA -8388608 -8388607 0 1 3 8388606 0 EXECUTE p_n_equal USING @maxint; colA -8388608 -8388607 0 1 3 8388606 0 EXECUTE p_eq USING @minint; colA -8388608 EXECUTE p_equal USING @minint; colA -8388608 EXECUTE p_n_eq USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @minint; colA -8388607 0 1 3 8388606 8388607 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 EXECUTE p_n_equal USING @minint_minus_1; colA -8388608 -8388607 0 1 3 8388606 8388607 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 = `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) = `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) < `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE 8388608 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = 8388607) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 <=> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE 8388607 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (8388607 <> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (`test`.`mediumtbls`.`colA` = <cache>(-(8388608))) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) <=> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388608 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where (<cache>(-(8388608)) <> `test`.`mediumtbls`.`colA`) EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where false EXPLAIN SELECT * FROM mediumtbls WHERE -8388609 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE mediumtbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`mediumtbls`.`colA` AS `colA` from `test`.`mediumtbls` where true DROP TABLE mediumtbls; # # Tests with UNSIGNED type INT against int # CREATE TABLE inttbl (colA INT UNSIGNED ); INSERT INTO inttbl VALUES (0), (1), (0),(1),(3), (4294967294), (4294967295), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 4294967294 4294967295 NULL SELECT * FROM inttbl WHERE colA < 4294967296; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA <= 4294967295; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA > 4294967296; colA SELECT * FROM inttbl WHERE colA >= 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE colA > -1; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA <= -1; colA SELECT * FROM inttbl WHERE colA <= 0; colA 0 0 SELECT * FROM inttbl WHERE colA >= 0; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA > 0; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA = 4294967296; colA SELECT * FROM inttbl WHERE colA <> 4294967296; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA = 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE colA <=> 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE NOT(colA <=> 4294967295); colA 0 1 0 1 3 4294967294 NULL SELECT * FROM inttbl WHERE colA <> 4294967295; colA 0 1 0 1 3 4294967294 SELECT * FROM inttbl WHERE colA = 0; colA 0 0 SELECT * FROM inttbl WHERE colA <=> 0; colA 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> 0); colA 1 1 3 4294967294 4294967295 NULL SELECT * FROM inttbl WHERE colA <> 0; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA = -1; colA SELECT * FROM inttbl WHERE colA <=> -1; colA SELECT * FROM inttbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 4294967294 4294967295 NULL SELECT * FROM inttbl WHERE colA <> -1; colA 0 1 0 1 3 4294967294 4294967295 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1=4294967296; SET @maxint=4294967295; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 4294967295 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_greater USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 NULL EXECUTE p_eq USING @maxint; colA 4294967295 EXECUTE p_equal USING @maxint; colA 4294967295 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 4294967294 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 4294967294 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint; colA 1 1 3 4294967294 4294967295 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA = 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA <> 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) same queries but constant first SELECT * FROM inttbl WHERE 4294967296 > colA; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 4294967295 >= colA; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 4294967296 < colA; colA SELECT * FROM inttbl WHERE 4294967295 <= colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 < colA; colA SELECT * FROM inttbl WHERE -1 < colA; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE -1 >= colA; colA SELECT * FROM inttbl WHERE 0 >= colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <= colA; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 0 < colA; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 4294967296 = colA; colA SELECT * FROM inttbl WHERE 4294967296 <=> colA; colA SELECT * FROM inttbl WHERE 4294967296 <> colA; colA 0 1 0 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 4294967295 = colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 <=> colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 <> colA; colA 0 1 0 1 3 4294967294 SELECT * FROM inttbl WHERE 0 = colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <=> colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <> colA; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE -1 = colA; colA SELECT * FROM inttbl WHERE -1 <=> colA; colA SELECT * FROM inttbl WHERE -1 <> colA; colA 0 1 0 1 3 4294967294 4294967295 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 4294967295 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_less USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 NULL EXECUTE p_eq USING @maxint; colA 4294967295 EXECUTE p_equal USING @maxint; colA 4294967295 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 4294967294 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 4294967294 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint; colA 1 1 3 4294967294 4294967295 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE 4294967296 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 4294967296 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967296 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967296 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967296 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) DROP TABLE inttbl; # # Tests with UNSIGNED type INT NOT NULL against int # CREATE TABLE inttbl (colA INT UNSIGNED NOT NULL); INSERT INTO inttbl VALUES (0), (1), (0),(1),(3), (4294967294), (4294967295), (0); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA < 4294967296; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA <= 4294967295; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA > 4294967296; colA SELECT * FROM inttbl WHERE colA >= 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE colA > -1; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA <= -1; colA SELECT * FROM inttbl WHERE colA <= 0; colA 0 0 0 SELECT * FROM inttbl WHERE colA >= 0; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA > 0; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA = 4294967296; colA SELECT * FROM inttbl WHERE colA <> 4294967296; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA = 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE colA <=> 4294967295; colA 4294967295 SELECT * FROM inttbl WHERE NOT(colA <=> 4294967295); colA 0 1 0 1 3 4294967294 0 SELECT * FROM inttbl WHERE colA <> 4294967295; colA 0 1 0 1 3 4294967294 0 SELECT * FROM inttbl WHERE colA = 0; colA 0 0 0 SELECT * FROM inttbl WHERE colA <=> 0; colA 0 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> 0); colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA <> 0; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE colA = -1; colA SELECT * FROM inttbl WHERE colA <=> -1; colA SELECT * FROM inttbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE colA <> -1; colA 0 1 0 1 3 4294967294 4294967295 0 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1=4294967296; SET @maxint=4294967295; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 4294967295 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_greater USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_eq USING @maxint; colA 4294967295 EXECUTE p_equal USING @maxint; colA 4294967295 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 4294967294 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 4294967294 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA <= 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA > 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA = 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA <> 4294967295; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 4294967295) EXPLAIN SELECT * FROM inttbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true same queries but constant first SELECT * FROM inttbl WHERE 4294967296 > colA; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE 4294967295 >= colA; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE 4294967296 < colA; colA SELECT * FROM inttbl WHERE 4294967295 <= colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 < colA; colA SELECT * FROM inttbl WHERE -1 < colA; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE -1 >= colA; colA SELECT * FROM inttbl WHERE 0 >= colA; colA 0 0 0 SELECT * FROM inttbl WHERE 0 <= colA; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE 0 < colA; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE 4294967296 = colA; colA SELECT * FROM inttbl WHERE 4294967296 <=> colA; colA SELECT * FROM inttbl WHERE 4294967296 <> colA; colA 0 1 0 1 3 4294967294 4294967295 0 SELECT * FROM inttbl WHERE 4294967295 = colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 <=> colA; colA 4294967295 SELECT * FROM inttbl WHERE 4294967295 <> colA; colA 0 1 0 1 3 4294967294 0 SELECT * FROM inttbl WHERE 0 = colA; colA 0 0 0 SELECT * FROM inttbl WHERE 0 <=> colA; colA 0 0 0 SELECT * FROM inttbl WHERE 0 <> colA; colA 1 1 3 4294967294 4294967295 SELECT * FROM inttbl WHERE -1 = colA; colA SELECT * FROM inttbl WHERE -1 <=> colA; colA SELECT * FROM inttbl WHERE -1 <> colA; colA 0 1 0 1 3 4294967294 4294967295 0 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 4294967295 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_less USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_eq USING @maxint; colA 4294967295 EXECUTE p_equal USING @maxint; colA 4294967295 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 4294967294 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 4294967294 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_n_equal USING @minint; colA 1 1 3 4294967294 4294967295 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 4294967294 4294967295 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE 4294967296 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE 4294967295 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE 4294967296 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967296 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967296 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 4294967296 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE 4294967295 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 4294967295) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 4294967295 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (4294967295 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true DROP TABLE inttbl; # # Tests with type INT against int # CREATE TABLE inttbls (colA INT ); INSERT INTO inttbls VALUES (-2147483648), (-2147483647), (0),(1),(3), (2147483646), (2147483647), (NULL); ANALYZE TABLE inttbls; Table Op Msg_type Msg_text test.inttbls analyze status OK SELECT * FROM inttbls; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL SELECT * FROM inttbls WHERE colA < 2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA <= 2147483647; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA > 2147483648; colA SELECT * FROM inttbls WHERE colA >= 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE colA > -2147483649; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA <= -2147483649; colA SELECT * FROM inttbls WHERE colA <= -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE colA >= -2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA > -2147483648; colA -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA = 2147483648; colA SELECT * FROM inttbls WHERE colA <> 2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA = 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE colA <=> 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE NOT(colA <=> 2147483647); colA -2147483648 -2147483647 0 1 3 2147483646 NULL SELECT * FROM inttbls WHERE colA <> 2147483647; colA -2147483648 -2147483647 0 1 3 2147483646 SELECT * FROM inttbls WHERE colA = -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE colA <=> -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE NOT(colA <=> -2147483648); colA -2147483647 0 1 3 2147483646 2147483647 NULL SELECT * FROM inttbls WHERE colA <> -2147483648; colA -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE colA = -2147483649; colA SELECT * FROM inttbls WHERE colA <=> -2147483649; colA SELECT * FROM inttbls WHERE NOT(colA <=> -2147483649); colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL SELECT * FROM inttbls WHERE colA <> -2147483649; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE colA <> ?'; SET @maxint_plus_1=2147483648; SET @maxint=2147483647; SET @minint_minus_1=-2147483649; SET @minint=-2147483648; EXECUTE p_less USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_less_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 2147483647 EXECUTE p_greater USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -2147483648 EXECUTE p_gret_eq USING @minint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_greater USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL EXECUTE p_eq USING @maxint; colA 2147483647 EXECUTE p_equal USING @maxint; colA 2147483647 EXECUTE p_n_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 EXECUTE p_n_equal USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 NULL EXECUTE p_eq USING @minint; colA -2147483648 EXECUTE p_equal USING @minint; colA -2147483648 EXECUTE p_n_eq USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE colA < 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA <= 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA > 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA >= 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA > -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA <= -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <= -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA >= -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA > -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` > <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA = 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA = 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA <=> 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA <> 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA = -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA <=> -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA <> -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA = -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) same queries but constant first SELECT * FROM inttbls WHERE 2147483648 > colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE 2147483647 >= colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE 2147483648 < colA; colA SELECT * FROM inttbls WHERE 2147483647 <= colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 < colA; colA SELECT * FROM inttbls WHERE -2147483649 < colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE -2147483649 >= colA; colA SELECT * FROM inttbls WHERE -2147483648 >= colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <= colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE -2147483648 < colA; colA -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE 2147483648 = colA; colA SELECT * FROM inttbls WHERE 2147483648 <=> colA; colA SELECT * FROM inttbls WHERE 2147483648 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE 2147483647 = colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 <=> colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 SELECT * FROM inttbls WHERE -2147483648 = colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <=> colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <> colA; colA -2147483647 0 1 3 2147483646 2147483647 SELECT * FROM inttbls WHERE -2147483649 = colA; colA SELECT * FROM inttbls WHERE -2147483649 <=> colA; colA SELECT * FROM inttbls WHERE -2147483649 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_gret_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 2147483647 EXECUTE p_less USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -2147483648 EXECUTE p_less_eq USING @minint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_less USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL EXECUTE p_eq USING @maxint; colA 2147483647 EXECUTE p_equal USING @maxint; colA 2147483647 EXECUTE p_n_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 EXECUTE p_n_equal USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 NULL EXECUTE p_eq USING @minint; colA -2147483648 EXECUTE p_equal USING @minint; colA -2147483648 EXECUTE p_n_eq USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 EXECUTE p_n_equal USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE 2147483648 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 2147483648 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE -2147483649 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483648 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) < `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483648 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483648 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483648 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483649 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) DROP TABLE inttbls; # # Tests with type INT NOT NULL against int # CREATE TABLE inttbls (colA INT NOT NULL); INSERT INTO inttbls VALUES (-2147483648), (-2147483647), (0),(1),(3), (2147483646), (2147483647), (0); ANALYZE TABLE inttbls; Table Op Msg_type Msg_text test.inttbls analyze status OK SELECT * FROM inttbls; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA < 2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA <= 2147483647; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA > 2147483648; colA SELECT * FROM inttbls WHERE colA >= 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE colA > -2147483649; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA <= -2147483649; colA SELECT * FROM inttbls WHERE colA <= -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE colA >= -2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA > -2147483648; colA -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA = 2147483648; colA SELECT * FROM inttbls WHERE colA <> 2147483648; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA = 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE colA <=> 2147483647; colA 2147483647 SELECT * FROM inttbls WHERE NOT(colA <=> 2147483647); colA -2147483648 -2147483647 0 1 3 2147483646 0 SELECT * FROM inttbls WHERE colA <> 2147483647; colA -2147483648 -2147483647 0 1 3 2147483646 0 SELECT * FROM inttbls WHERE colA = -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE colA <=> -2147483648; colA -2147483648 SELECT * FROM inttbls WHERE NOT(colA <=> -2147483648); colA -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA <> -2147483648; colA -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA = -2147483649; colA SELECT * FROM inttbls WHERE colA <=> -2147483649; colA SELECT * FROM inttbls WHERE NOT(colA <=> -2147483649); colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE colA <> -2147483649; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE colA <> ?'; SET @maxint_plus_1=2147483648; SET @maxint=2147483647; SET @minint_minus_1=-2147483649; SET @minint=-2147483648; EXECUTE p_less USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_less_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 2147483647 EXECUTE p_greater USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -2147483648 EXECUTE p_gret_eq USING @minint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_greater USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @maxint; colA 2147483647 EXECUTE p_equal USING @maxint; colA 2147483647 EXECUTE p_n_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 0 EXECUTE p_n_equal USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 0 EXECUTE p_eq USING @minint; colA -2147483648 EXECUTE p_equal USING @minint; colA -2147483648 EXECUTE p_n_eq USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE colA < 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA <= 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA > 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA >= 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA > -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA <= -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <= -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA >= -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA > -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` > <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA = 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> 2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA = 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA <=> 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA <> 2147483647; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> 2147483647) EXPLAIN SELECT * FROM inttbls WHERE colA = -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA <=> -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA <> -2147483648; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE colA = -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> -2147483649; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true same queries but constant first SELECT * FROM inttbls WHERE 2147483648 > colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE 2147483647 >= colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE 2147483648 < colA; colA SELECT * FROM inttbls WHERE 2147483647 <= colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 < colA; colA SELECT * FROM inttbls WHERE -2147483649 < colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE -2147483649 >= colA; colA SELECT * FROM inttbls WHERE -2147483648 >= colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <= colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE -2147483648 < colA; colA -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE 2147483648 = colA; colA SELECT * FROM inttbls WHERE 2147483648 <=> colA; colA SELECT * FROM inttbls WHERE 2147483648 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE 2147483647 = colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 <=> colA; colA 2147483647 SELECT * FROM inttbls WHERE 2147483647 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 0 SELECT * FROM inttbls WHERE -2147483648 = colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <=> colA; colA -2147483648 SELECT * FROM inttbls WHERE -2147483648 <> colA; colA -2147483647 0 1 3 2147483646 2147483647 0 SELECT * FROM inttbls WHERE -2147483649 = colA; colA SELECT * FROM inttbls WHERE -2147483649 <=> colA; colA SELECT * FROM inttbls WHERE -2147483649 <> colA; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_gret_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 2147483647 EXECUTE p_less USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -2147483648 EXECUTE p_less_eq USING @minint; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_less USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @maxint; colA 2147483647 EXECUTE p_equal USING @maxint; colA 2147483647 EXECUTE p_n_eq USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 0 EXECUTE p_n_equal USING @maxint; colA -2147483648 -2147483647 0 1 3 2147483646 0 EXECUTE p_eq USING @minint; colA -2147483648 EXECUTE p_equal USING @minint; colA -2147483648 EXECUTE p_n_eq USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @minint; colA -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 EXECUTE p_n_equal USING @minint_minus_1; colA -2147483648 -2147483647 0 1 3 2147483646 2147483647 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE 2147483648 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 2147483647 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 2147483648 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE -2147483649 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483648 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE -2147483648 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) < `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483648 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483648 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 2147483648 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 2147483647 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 2147483647) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 2147483647 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (2147483647 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = <cache>(-(2147483648))) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483648 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (<cache>(-(2147483648)) <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -2147483649 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -2147483649 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true DROP TABLE inttbls; # # Tests with UNSIGNED type BIGINT against int # CREATE TABLE inttbl (colA BIGINT UNSIGNED ); INSERT INTO inttbl VALUES (0), (1), (0),(1),(3), (18446744073709551614), (18446744073709551615), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA < 18446744073709551616; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= 18446744073709551615; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > 18446744073709551616; colA SELECT * FROM inttbl WHERE colA >= 18446744073709551615; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA > -1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= -1; colA SELECT * FROM inttbl WHERE colA <= 0; colA 0 0 SELECT * FROM inttbl WHERE colA >= 0; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > 0; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = 18446744073709551616; colA SELECT * FROM inttbl WHERE colA <> 18446744073709551616; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = 18446744073709551615; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <=> 18446744073709551615; colA 18446744073709551615 SELECT * FROM inttbl WHERE NOT(colA <=> 18446744073709551615); colA 0 1 0 1 3 18446744073709551614 NULL SELECT * FROM inttbl WHERE colA <> 18446744073709551615; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA = 0; colA 0 0 SELECT * FROM inttbl WHERE colA <=> 0; colA 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> 0); colA 1 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> 0; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -1; colA SELECT * FROM inttbl WHERE colA <=> -1; colA SELECT * FROM inttbl WHERE NOT(colA <=> -1); colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> -1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1=18446744073709551616; SET @maxint=18446744073709551615; SET @minint_minus_1=-1; SET @minint=0; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 18446744073709551615 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < 18446744073709551616; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= 18446744073709551615; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > 18446744073709551616; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= 18446744073709551615; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = 18446744073709551616; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> 18446744073709551616; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> 18446744073709551616; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA = 18446744073709551615; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 18446744073709551615; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <> 18446744073709551615; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) same queries but constant first SELECT * FROM inttbl WHERE 18446744073709551616 > colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551615 >= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551616 < colA; colA SELECT * FROM inttbl WHERE 18446744073709551615 <= colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551615 < colA; colA SELECT * FROM inttbl WHERE -1 < colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE -1 >= colA; colA SELECT * FROM inttbl WHERE 0 >= colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE 0 < colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551616 = colA; colA SELECT * FROM inttbl WHERE 18446744073709551616 <=> colA; colA SELECT * FROM inttbl WHERE 18446744073709551616 <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551615 = colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551615 <=> colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE 18446744073709551615 <> colA; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE 0 = colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <=> colA; colA 0 0 SELECT * FROM inttbl WHERE 0 <> colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE -1 = colA; colA SELECT * FROM inttbl WHERE -1 <=> colA; colA SELECT * FROM inttbl WHERE -1 <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 18446744073709551615 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551616 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551616 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE -1 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 0 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 0 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551616 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551616 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551616 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 18446744073709551615 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE 0 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE 0 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE -1 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE -1 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) DROP TABLE inttbl; # # Tests with UNSIGNED type BIGINT against decimal # CREATE TABLE inttbl (colA BIGINT UNSIGNED ); INSERT INTO inttbl VALUES (0), (1), (0),(1),(3), (18446744073709551614), (18446744073709551615), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA < 0.5; colA 0 0 SELECT * FROM inttbl WHERE colA <= 0.5; colA 0 0 SELECT * FROM inttbl WHERE colA > 0.5; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= 0.5; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = 0.5; colA SELECT * FROM inttbl WHERE colA <> 0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < -0.5; colA SELECT * FROM inttbl WHERE colA <= -0.5; colA SELECT * FROM inttbl WHERE colA > -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -0.5; colA SELECT * FROM inttbl WHERE colA <> -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < 18446744073709551615.00001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= 18446744073709551615.00001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > 18446744073709551615.00001; colA SELECT * FROM inttbl WHERE colA >= 18446744073709551615.00001; colA SELECT * FROM inttbl WHERE colA = 18446744073709551615.00001; colA SELECT * FROM inttbl WHERE colA <> 18446744073709551615.00001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < 18446744073709551614.99999; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA <= 18446744073709551614.99999; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA > 18446744073709551614.99999; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA >= 18446744073709551614.99999; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA = 18446744073709551614.99999; colA SELECT * FROM inttbl WHERE colA <> 18446744073709551614.99999; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < 0.00001; colA 0 0 SELECT * FROM inttbl WHERE colA <= 0.00001; colA 0 0 SELECT * FROM inttbl WHERE colA > 0.00001; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= 0.00001; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = 0.00001; colA SELECT * FROM inttbl WHERE colA <> 0.00001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < -0.99999; colA SELECT * FROM inttbl WHERE colA <= -0.99999; colA SELECT * FROM inttbl WHERE colA > -0.99999; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= -0.99999; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -0.99999; colA SELECT * FROM inttbl WHERE colA <> -0.99999; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta=18446744073709551615.00001; SET @dec_max_minus_delta=18446744073709551614.99999; SET @dec_min_plus_delta=0.00001; SET @dec_min_minus_delta=-0.99999; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_greater USING @dec_max_minus_delta; colA 18446744073709551615 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 18446744073709551615 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE inttbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with UNSIGNED type BIGINT against int # CREATE TABLE inttbl (colA BIGINT UNSIGNED ); INSERT INTO inttbl VALUES ('0'), ('1'), (0),(1),(3), ('18446744073709551614'), ('18446744073709551615'), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA < '18446744073709551616'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= '18446744073709551615'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '18446744073709551616'; colA SELECT * FROM inttbl WHERE colA >= '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA > '-1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= '-1'; colA SELECT * FROM inttbl WHERE colA <= '0'; colA 0 0 SELECT * FROM inttbl WHERE colA >= '0'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551616'; colA SELECT * FROM inttbl WHERE colA <> '18446744073709551616'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <=> '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE NOT(colA <=> '18446744073709551615'); colA 0 1 0 1 3 18446744073709551614 NULL SELECT * FROM inttbl WHERE colA <> '18446744073709551615'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA = '0'; colA 0 0 SELECT * FROM inttbl WHERE colA <=> '0'; colA 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> '0'); colA 1 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> '0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '-1'; colA SELECT * FROM inttbl WHERE colA <=> '-1'; colA SELECT * FROM inttbl WHERE NOT(colA <=> '-1'); colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> '-1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1='18446744073709551616'; SET @maxint='18446744073709551615'; SET @minint_minus_1='-1'; SET @minint='0'; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 18446744073709551615 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA > '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA = '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) same queries but constant first SELECT * FROM inttbl WHERE '18446744073709551616' > colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' >= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551616' < colA; colA SELECT * FROM inttbl WHERE '18446744073709551615' <= colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' < colA; colA SELECT * FROM inttbl WHERE '-1' < colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '-1' >= colA; colA SELECT * FROM inttbl WHERE '0' >= colA; colA 0 0 SELECT * FROM inttbl WHERE '0' <= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '0' < colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551616' = colA; colA SELECT * FROM inttbl WHERE '18446744073709551616' <=> colA; colA SELECT * FROM inttbl WHERE '18446744073709551616' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' = colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' <=> colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' <> colA; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE '0' = colA; colA 0 0 SELECT * FROM inttbl WHERE '0' <=> colA; colA 0 0 SELECT * FROM inttbl WHERE '0' <> colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '-1' = colA; colA SELECT * FROM inttbl WHERE '-1' <=> colA; colA SELECT * FROM inttbl WHERE '-1' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 18446744073709551615 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '-1' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE '0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '-1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) DROP TABLE inttbl; # # Tests with UNSIGNED type BIGINT NOT NULL against int # CREATE TABLE inttbl (colA BIGINT UNSIGNED NOT NULL); INSERT INTO inttbl VALUES ('0'), ('1'), (0),(1),(3), ('18446744073709551614'), ('18446744073709551615'), (0); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA < '18446744073709551616'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA <= '18446744073709551615'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA > '18446744073709551616'; colA SELECT * FROM inttbl WHERE colA >= '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA > '-1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA <= '-1'; colA SELECT * FROM inttbl WHERE colA <= '0'; colA 0 0 0 SELECT * FROM inttbl WHERE colA >= '0'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA > '0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551616'; colA SELECT * FROM inttbl WHERE colA <> '18446744073709551616'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA = '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <=> '18446744073709551615'; colA 18446744073709551615 SELECT * FROM inttbl WHERE NOT(colA <=> '18446744073709551615'); colA 0 1 0 1 3 18446744073709551614 0 SELECT * FROM inttbl WHERE colA <> '18446744073709551615'; colA 0 1 0 1 3 18446744073709551614 0 SELECT * FROM inttbl WHERE colA = '0'; colA 0 0 0 SELECT * FROM inttbl WHERE colA <=> '0'; colA 0 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> '0'); colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <> '0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '-1'; colA SELECT * FROM inttbl WHERE colA <=> '-1'; colA SELECT * FROM inttbl WHERE NOT(colA <=> '-1'); colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE colA <> '-1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1='18446744073709551616'; SET @maxint='18446744073709551615'; SET @minint_minus_1='-1'; SET @minint='0'; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 18446744073709551615 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_greater USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA <= '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA > '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA > '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA <= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA > '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551616'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551615'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA = '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true same queries but constant first SELECT * FROM inttbl WHERE '18446744073709551616' > colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE '18446744073709551615' >= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE '18446744073709551616' < colA; colA SELECT * FROM inttbl WHERE '18446744073709551615' <= colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' < colA; colA SELECT * FROM inttbl WHERE '-1' < colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE '-1' >= colA; colA SELECT * FROM inttbl WHERE '0' >= colA; colA 0 0 0 SELECT * FROM inttbl WHERE '0' <= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE '0' < colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551616' = colA; colA SELECT * FROM inttbl WHERE '18446744073709551616' <=> colA; colA SELECT * FROM inttbl WHERE '18446744073709551616' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 SELECT * FROM inttbl WHERE '18446744073709551615' = colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' <=> colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615' <> colA; colA 0 1 0 1 3 18446744073709551614 0 SELECT * FROM inttbl WHERE '0' = colA; colA 0 0 0 SELECT * FROM inttbl WHERE '0' <=> colA; colA 0 0 0 SELECT * FROM inttbl WHERE '0' <> colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '-1' = colA; colA SELECT * FROM inttbl WHERE '-1' <=> colA; colA SELECT * FROM inttbl WHERE '-1' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 18446744073709551615 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_less USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 0 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 0 EXECUTE p_eq USING @minint; colA 0 0 0 EXECUTE p_equal USING @minint; colA 0 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE '-1' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE '0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE '0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '-1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where true DROP TABLE inttbl; # # Tests with UNSIGNED type BIGINT against int # CREATE TABLE inttbl (colA BIGINT UNSIGNED ); INSERT INTO inttbl VALUES ('0.0'), ('1.0'), (0),(1),(3), ('18446744073709551614.0'), ('18446744073709551615.0'), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA < '18446744073709551616.1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= '18446744073709551615.0'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '18446744073709551616.1'; colA SELECT * FROM inttbl WHERE colA >= '18446744073709551615.0'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA > '-1.1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= '-1.1'; colA SELECT * FROM inttbl WHERE colA <= '0.0'; colA 0 0 SELECT * FROM inttbl WHERE colA >= '0.0'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '0.0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551616.1'; colA SELECT * FROM inttbl WHERE colA <> '18446744073709551616.1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551615.0'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <=> '18446744073709551615.0'; colA 18446744073709551615 SELECT * FROM inttbl WHERE NOT(colA <=> '18446744073709551615.0'); colA 0 1 0 1 3 18446744073709551614 NULL SELECT * FROM inttbl WHERE colA <> '18446744073709551615.0'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA = '0.0'; colA 0 0 SELECT * FROM inttbl WHERE colA <=> '0.0'; colA 0 0 SELECT * FROM inttbl WHERE NOT(colA <=> '0.0'); colA 1 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> '0.0'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '-1.1'; colA SELECT * FROM inttbl WHERE colA <=> '-1.1'; colA SELECT * FROM inttbl WHERE NOT(colA <=> '-1.1'); colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA <> '-1.1'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @maxint_plus_1='18446744073709551616.1'; SET @maxint='18446744073709551615.0'; SET @minint_minus_1='-1.1'; SET @minint='0.0'; EXECUTE p_less USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 18446744073709551615 EXECUTE p_greater USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA 0 0 EXECUTE p_gret_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE colA < '18446744073709551616.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= '18446744073709551615.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > '18446744073709551616.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA >= '18446744073709551615.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA > '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA <= '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA >= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA > '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` > 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551616.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551616.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551616.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE colA = '18446744073709551615.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '18446744073709551615.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA <> '18446744073709551615.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE colA = '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE colA <=> '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <=> 0) EXPLAIN SELECT * FROM inttbl WHERE colA <> '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` <> 0) EXPLAIN SELECT * FROM inttbl WHERE colA = '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <=> '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE colA <> '-1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) same queries but constant first SELECT * FROM inttbl WHERE '18446744073709551616.1' > colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615.0' >= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551616.1' < colA; colA SELECT * FROM inttbl WHERE '18446744073709551615.0' <= colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615.0' < colA; colA SELECT * FROM inttbl WHERE '-1.1' < colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '-1.1' >= colA; colA SELECT * FROM inttbl WHERE '0.0' >= colA; colA 0 0 SELECT * FROM inttbl WHERE '0.0' <= colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '0.0' < colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551616.1' = colA; colA SELECT * FROM inttbl WHERE '18446744073709551616.1' <=> colA; colA SELECT * FROM inttbl WHERE '18446744073709551616.1' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615.0' = colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615.0' <=> colA; colA 18446744073709551615 SELECT * FROM inttbl WHERE '18446744073709551615.0' <> colA; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE '0.0' = colA; colA 0 0 SELECT * FROM inttbl WHERE '0.0' <=> colA; colA 0 0 SELECT * FROM inttbl WHERE '0.0' <> colA; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE '-1.1' = colA; colA SELECT * FROM inttbl WHERE '-1.1' <=> colA; colA SELECT * FROM inttbl WHERE '-1.1' <> colA; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbl WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbl WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 18446744073709551615 EXECUTE p_less USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA 0 0 EXECUTE p_less_eq USING @minint; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @maxint_plus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @maxint; colA 18446744073709551615 EXECUTE p_equal USING @maxint; colA 18446744073709551615 EXECUTE p_n_eq USING @maxint; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_n_equal USING @maxint; colA 0 1 0 1 3 18446744073709551614 NULL EXECUTE p_eq USING @minint; colA 0 0 EXECUTE p_equal USING @minint; colA 0 0 EXECUTE p_n_eq USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint; colA 1 1 3 18446744073709551614 18446744073709551615 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_n_equal USING @minint_minus_1; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616.1' > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616.1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1.1' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '-1.1' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '0.0' >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 = `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0.0' <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '0.0' < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 < `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616.1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616.1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551616.1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 18446744073709551615) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '18446744073709551615.0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (18446744073709551615 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0.0' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` = 0) EXPLAIN SELECT * FROM inttbl WHERE '0.0' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <=> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '0.0' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (0 <> `test`.`inttbl`.`colA`) EXPLAIN SELECT * FROM inttbl WHERE '-1.1' = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1.1' <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where false EXPLAIN SELECT * FROM inttbl WHERE '-1.1' <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbl NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbl`.`colA` AS `colA` from `test`.`inttbl` where (`test`.`inttbl`.`colA` is not null) DROP TABLE inttbl; # # Tests with UNSIGNED type BIGINT against decimal # CREATE TABLE inttbl (colA BIGINT UNSIGNED ); INSERT INTO inttbl VALUES ('0.0'), ('1.0'), (0),(1),(3), ('18446744073709551614.0'), ('18446744073709551615.0'), (NULL); ANALYZE TABLE inttbl; Table Op Msg_type Msg_text test.inttbl analyze status OK SELECT * FROM inttbl; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 NULL SELECT * FROM inttbl WHERE colA < 0.5; colA 0 0 SELECT * FROM inttbl WHERE colA <= 0.5; colA 0 0 SELECT * FROM inttbl WHERE colA > 0.5; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= 0.5; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = 0.5; colA SELECT * FROM inttbl WHERE colA <> 0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < -0.5; colA SELECT * FROM inttbl WHERE colA <= -0.5; colA SELECT * FROM inttbl WHERE colA > -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -0.5; colA SELECT * FROM inttbl WHERE colA <> -0.5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < '18446744073709551615.00001'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA <= '18446744073709551615.00001'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '18446744073709551615.00001'; colA SELECT * FROM inttbl WHERE colA >= '18446744073709551615.00001'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551615.00001'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <> '18446744073709551615.00001'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA < '18446744073709551614.99999'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA <= '18446744073709551614.99999'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > '18446744073709551614.99999'; colA SELECT * FROM inttbl WHERE colA >= '18446744073709551614.99999'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA = '18446744073709551614.99999'; colA 18446744073709551615 SELECT * FROM inttbl WHERE colA <> '18446744073709551614.99999'; colA 0 1 0 1 3 18446744073709551614 SELECT * FROM inttbl WHERE colA < '0.00001'; colA 0 0 SELECT * FROM inttbl WHERE colA <= '0.00001'; colA 0 0 SELECT * FROM inttbl WHERE colA > '0.00001'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= '0.00001'; colA 1 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '0.00001'; colA SELECT * FROM inttbl WHERE colA <> '0.00001'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < '-0.99999'; colA SELECT * FROM inttbl WHERE colA <= '-0.99999'; colA SELECT * FROM inttbl WHERE colA > '-0.99999'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= '-0.99999'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = '-0.99999'; colA SELECT * FROM inttbl WHERE colA <> '-0.99999'; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA <= 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA > 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA >= 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA = 18446744073709551615.00000001; colA SELECT * FROM inttbl WHERE colA <> 18446744073709551615.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA < -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA <= -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA > -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA >= -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 SELECT * FROM inttbl WHERE colA = -9223372036854775808.00000001; colA SELECT * FROM inttbl WHERE colA <> -9223372036854775808.00000001; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 PREPARE p_less FROM 'SELECT * FROM inttbl WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbl WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbl WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbl WHERE colA >= ?'; PREPARE p_equal FROM 'SELECT * FROM inttbl WHERE colA = ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbl WHERE colA <> ?'; SET @dec_0_5=0.5; SET @dec_minus_0_5=-0.5; SET @dec_max_plus_delta='18446744073709551615.00001'; SET @dec_max_minus_delta='18446744073709551614.99999'; SET @dec_min_plus_delta='0.00001'; SET @dec_min_minus_delta='-0.99999'; SET @dec_too_big_positive_for_any_int=18446744073709551615.00000001; SET @dec_too_big_negative_for_any_int=-9223372036854775808.00000001; EXECUTE p_less USING @dec_0_5; colA 0 0 EXECUTE p_less_eq USING @dec_0_5; colA 0 0 EXECUTE p_greater USING @dec_0_5; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_0_5; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_0_5; colA EXECUTE p_n_equal USING @dec_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_minus_0_5; colA EXECUTE p_less_eq USING @dec_minus_0_5; colA EXECUTE p_greater USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_minus_0_5; colA EXECUTE p_n_equal USING @dec_minus_0_5; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @dec_max_plus_delta; colA EXECUTE p_gret_eq USING @dec_max_plus_delta; colA EXECUTE p_equal USING @dec_max_plus_delta; colA EXECUTE p_n_equal USING @dec_max_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_less_eq USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 EXECUTE p_greater USING @dec_max_minus_delta; colA 18446744073709551615 EXECUTE p_gret_eq USING @dec_max_minus_delta; colA 18446744073709551615 EXECUTE p_equal USING @dec_max_minus_delta; colA EXECUTE p_n_equal USING @dec_max_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_min_plus_delta; colA 0 0 EXECUTE p_less_eq USING @dec_min_plus_delta; colA 0 0 EXECUTE p_greater USING @dec_min_plus_delta; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_min_plus_delta; colA 1 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_min_plus_delta; colA EXECUTE p_n_equal USING @dec_min_plus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_min_minus_delta; colA EXECUTE p_less_eq USING @dec_min_minus_delta; colA EXECUTE p_greater USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_min_minus_delta; colA EXECUTE p_n_equal USING @dec_min_minus_delta; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less_eq USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_greater USING @dec_too_big_positive_for_any_int; colA EXECUTE p_gret_eq USING @dec_too_big_positive_for_any_int; colA EXECUTE p_equal USING @dec_too_big_positive_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_positive_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_less USING @dec_too_big_negative_for_any_int; colA EXECUTE p_less_eq USING @dec_too_big_negative_for_any_int; colA EXECUTE p_greater USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_gret_eq USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 EXECUTE p_equal USING @dec_too_big_negative_for_any_int; colA EXECUTE p_n_equal USING @dec_too_big_negative_for_any_int; colA 0 1 0 1 3 18446744073709551614 18446744073709551615 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_equal; DROP TABLE inttbl; Cruft inside string CREATE TABLE t(i INT); INSERT INTO t VALUES (-1), (0), (1); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i > 'A'; i 1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' EXPLAIN SELECT * FROM t WHERE i > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` > 0) DROP TABLE t; Detect decimal inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i BIGINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i = '1.1'; i EXPLAIN SELECT * FROM t WHERE i = '1.1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (1), (2); SELECT * FROM t WHERE i > '1E10'; i EXPLAIN SELECT * FROM t WHERE i > '1E10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; Detect out of range real inside a string when compared to int Used to return one row; should be none. CREATE TABLE t(i TINYINT); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (0); SELECT * FROM t WHERE i = '1E-308'; i EXPLAIN SELECT * FROM t WHERE i = '1E-308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false Above query should yield the same as this: SELECT * FROM t WHERE i = 1E-308; i EXPLAIN SELECT * FROM t WHERE i = 1E-308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where false DROP TABLE t; # # Tests with type BIGINT against int # CREATE TABLE inttbls (colA BIGINT ); INSERT INTO inttbls VALUES (-9223372036854775808), (-9223372036854775807), (0),(1),(3), (9223372036854775806), (9223372036854775807), (NULL); ANALYZE TABLE inttbls; Table Op Msg_type Msg_text test.inttbls analyze status OK SELECT * FROM inttbls; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL SELECT * FROM inttbls WHERE colA < 9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA <= 9223372036854775807; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA > 9223372036854775808; colA SELECT * FROM inttbls WHERE colA >= 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE colA > -9223372036854775809; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA <= -9223372036854775809; colA SELECT * FROM inttbls WHERE colA <= -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE colA >= -9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA > -9223372036854775808; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA = 9223372036854775808; colA SELECT * FROM inttbls WHERE colA <> 9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA = 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE colA <=> 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE NOT(colA <=> 9223372036854775807); colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 NULL SELECT * FROM inttbls WHERE colA <> 9223372036854775807; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 SELECT * FROM inttbls WHERE colA = -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE colA <=> -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE NOT(colA <=> -9223372036854775808); colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL SELECT * FROM inttbls WHERE colA <> -9223372036854775808; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE colA = -9223372036854775809; colA SELECT * FROM inttbls WHERE colA <=> -9223372036854775809; colA SELECT * FROM inttbls WHERE NOT(colA <=> -9223372036854775809); colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL SELECT * FROM inttbls WHERE colA <> -9223372036854775809; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE colA <> ?'; SET @maxint_plus_1=9223372036854775808; SET @maxint=9223372036854775807; SET @minint_minus_1=-9223372036854775809; SET @minint=-9223372036854775808; EXECUTE p_less USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_less_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 9223372036854775807 EXECUTE p_greater USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -9223372036854775808 EXECUTE p_gret_eq USING @minint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_greater USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL EXECUTE p_eq USING @maxint; colA 9223372036854775807 EXECUTE p_equal USING @maxint; colA 9223372036854775807 EXECUTE p_n_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 EXECUTE p_n_equal USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 NULL EXECUTE p_eq USING @minint; colA -9223372036854775808 EXECUTE p_equal USING @minint; colA -9223372036854775808 EXECUTE p_n_eq USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE colA < 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA <= 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA > 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA >= 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA > -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA <= -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <= -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA >= -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA > -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` > -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA = 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE colA = 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA <=> 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA <> 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA = -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA <=> -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA <> -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA = -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) same queries but constant first SELECT * FROM inttbls WHERE 9223372036854775808 > colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 >= colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775808 < colA; colA SELECT * FROM inttbls WHERE 9223372036854775807 <= colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 < colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 < colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE -9223372036854775809 >= colA; colA SELECT * FROM inttbls WHERE -9223372036854775808 >= colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <= colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE -9223372036854775808 < colA; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775808 = colA; colA SELECT * FROM inttbls WHERE 9223372036854775808 <=> colA; colA SELECT * FROM inttbls WHERE 9223372036854775808 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 = colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 <=> colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 SELECT * FROM inttbls WHERE -9223372036854775808 = colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <=> colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <> colA; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 SELECT * FROM inttbls WHERE -9223372036854775809 = colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 <=> colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_gret_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 9223372036854775807 EXECUTE p_less USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -9223372036854775808 EXECUTE p_less_eq USING @minint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_less USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL EXECUTE p_eq USING @maxint; colA 9223372036854775807 EXECUTE p_equal USING @maxint; colA 9223372036854775807 EXECUTE p_n_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 EXECUTE p_n_equal USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 NULL EXECUTE p_eq USING @minint; colA -9223372036854775808 EXECUTE p_equal USING @minint; colA -9223372036854775808 EXECUTE p_n_eq USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 EXECUTE p_n_equal USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 NULL DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 < `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` is not null) DROP TABLE inttbls; # # Tests with type BIGINT NOT NULL against int # CREATE TABLE inttbls (colA BIGINT NOT NULL); INSERT INTO inttbls VALUES (-9223372036854775808), (-9223372036854775807), (0),(1),(3), (9223372036854775806), (9223372036854775807), (0); ANALYZE TABLE inttbls; Table Op Msg_type Msg_text test.inttbls analyze status OK SELECT * FROM inttbls; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA < 9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA <= 9223372036854775807; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA > 9223372036854775808; colA SELECT * FROM inttbls WHERE colA >= 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE colA > -9223372036854775809; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA <= -9223372036854775809; colA SELECT * FROM inttbls WHERE colA <= -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE colA >= -9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA > -9223372036854775808; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA = 9223372036854775808; colA SELECT * FROM inttbls WHERE colA <> 9223372036854775808; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA = 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE colA <=> 9223372036854775807; colA 9223372036854775807 SELECT * FROM inttbls WHERE NOT(colA <=> 9223372036854775807); colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 SELECT * FROM inttbls WHERE colA <> 9223372036854775807; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 SELECT * FROM inttbls WHERE colA = -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE colA <=> -9223372036854775808; colA -9223372036854775808 SELECT * FROM inttbls WHERE NOT(colA <=> -9223372036854775808); colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA <> -9223372036854775808; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA = -9223372036854775809; colA SELECT * FROM inttbls WHERE colA <=> -9223372036854775809; colA SELECT * FROM inttbls WHERE NOT(colA <=> -9223372036854775809); colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE colA <> -9223372036854775809; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE colA < ?'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE colA <= ?'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE colA > ?'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE colA >= ?'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE colA = ?'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE colA <=> ?'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(colA <=> ?)'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE colA <> ?'; SET @maxint_plus_1=9223372036854775808; SET @maxint=9223372036854775807; SET @minint_minus_1=-9223372036854775809; SET @minint=-9223372036854775808; EXECUTE p_less USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_less_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_greater USING @maxint_plus_1; colA EXECUTE p_gret_eq USING @maxint; colA 9223372036854775807 EXECUTE p_greater USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_less_eq USING @minint_minus_1; colA EXECUTE p_less_eq USING @minint; colA -9223372036854775808 EXECUTE p_gret_eq USING @minint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_greater USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @maxint; colA 9223372036854775807 EXECUTE p_equal USING @maxint; colA 9223372036854775807 EXECUTE p_n_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 EXECUTE p_n_equal USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 EXECUTE p_eq USING @minint; colA -9223372036854775808 EXECUTE p_equal USING @minint; colA -9223372036854775808 EXECUTE p_n_eq USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE colA < 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA <= 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA > 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA >= 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA > -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA <= -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <= -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA >= -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA > -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` > -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA = 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> 9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE colA = 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA <=> 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA <> 9223372036854775807; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE colA = -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA <=> -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <=> -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA <> -9223372036854775808; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` <> -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE colA = -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <=> -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE colA <> -9223372036854775809; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true same queries but constant first SELECT * FROM inttbls WHERE 9223372036854775808 > colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE 9223372036854775807 >= colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE 9223372036854775808 < colA; colA SELECT * FROM inttbls WHERE 9223372036854775807 <= colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 < colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 < colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE -9223372036854775809 >= colA; colA SELECT * FROM inttbls WHERE -9223372036854775808 >= colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <= colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE -9223372036854775808 < colA; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE 9223372036854775808 = colA; colA SELECT * FROM inttbls WHERE 9223372036854775808 <=> colA; colA SELECT * FROM inttbls WHERE 9223372036854775808 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE 9223372036854775807 = colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 <=> colA; colA 9223372036854775807 SELECT * FROM inttbls WHERE 9223372036854775807 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 SELECT * FROM inttbls WHERE -9223372036854775808 = colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <=> colA; colA -9223372036854775808 SELECT * FROM inttbls WHERE -9223372036854775808 <> colA; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 SELECT * FROM inttbls WHERE -9223372036854775809 = colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 <=> colA; colA SELECT * FROM inttbls WHERE -9223372036854775809 <> colA; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 PREPARE p_less FROM 'SELECT * FROM inttbls WHERE ? < colA'; PREPARE p_less_eq FROM 'SELECT * FROM inttbls WHERE ? <= colA'; PREPARE p_greater FROM 'SELECT * FROM inttbls WHERE ? > colA'; PREPARE p_gret_eq FROM 'SELECT * FROM inttbls WHERE ? >= colA'; PREPARE p_eq FROM 'SELECT * FROM inttbls WHERE ? = colA'; PREPARE p_equal FROM 'SELECT * FROM inttbls WHERE ? <=> colA'; PREPARE p_n_eq FROM 'SELECT * FROM inttbls WHERE ? <> colA'; PREPARE p_n_equal FROM 'SELECT * FROM inttbls WHERE NOT(? <=> colA)'; EXECUTE p_greater USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_gret_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_less USING @maxint_plus_1; colA EXECUTE p_less_eq USING @maxint; colA 9223372036854775807 EXECUTE p_less USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_gret_eq USING @minint_minus_1; colA EXECUTE p_gret_eq USING @minint; colA -9223372036854775808 EXECUTE p_less_eq USING @minint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_less USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @maxint_plus_1; colA EXECUTE p_equal USING @maxint_plus_1; colA EXECUTE p_n_eq USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @maxint_plus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @maxint; colA 9223372036854775807 EXECUTE p_equal USING @maxint; colA 9223372036854775807 EXECUTE p_n_eq USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 EXECUTE p_n_equal USING @maxint; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 0 EXECUTE p_eq USING @minint; colA -9223372036854775808 EXECUTE p_equal USING @minint; colA -9223372036854775808 EXECUTE p_n_eq USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @minint; colA -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_eq USING @minint_minus_1; colA EXECUTE p_equal USING @minint_minus_1; colA EXECUTE p_n_eq USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 EXECUTE p_n_equal USING @minint_minus_1; colA -9223372036854775808 -9223372036854775807 0 1 3 9223372036854775806 9223372036854775807 0 DROP PREPARE p_less; DROP PREPARE p_less_eq; DROP PREPARE p_greater; DROP PREPARE p_gret_eq; DROP PREPARE p_equal; DROP PREPARE p_n_eq; DROP PREPARE p_n_equal; EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 > colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 >= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 = `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <= colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 < colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 < `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775808 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = 9223372036854775807) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE 9223372036854775807 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (9223372036854775807 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (`test`.`inttbls`.`colA` = -9223372036854775808) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 12.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 <=> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775808 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 87.50 Using where Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where (-9223372036854775808 <> `test`.`inttbls`.`colA`) EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 = colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 <=> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where false EXPLAIN SELECT * FROM inttbls WHERE -9223372036854775809 <> colA; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE inttbls NULL ALL NULL NULL NULL NULL 8 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`inttbls`.`colA` AS `colA` from `test`.`inttbls` where true DROP TABLE inttbls; CREATE TABLE t(u TINYINT UNSIGNED); INSERT INTO t VALUES (0), (3), (255), (NULL); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE u=256 IS NOT NULL; u 0 3 255 SELECT * FROM t WHERE u=256 IS NULL; u NULL SELECT * FROM t WHERE u=256 IS UNKNOWN; u NULL SELECT * FROM t WHERE ABS(u=256)=0; u 0 3 255 SELECT * FROM t WHERE u=256; u EXPLAIN SELECT * FROM t WHERE u=256 IS NOT NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where ((`test`.`t`.`u` <> `test`.`t`.`u`) is not null) EXPLAIN SELECT * FROM t WHERE u=256 IS NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where ((`test`.`t`.`u` <> `test`.`t`.`u`) is null) EXPLAIN SELECT * FROM t WHERE u=256 IS UNKNOWN; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where ((`test`.`t`.`u` <> `test`.`t`.`u`) is null) EXPLAIN SELECT * FROM t WHERE ABS(u=256)=0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where (abs((`test`.`t`.`u` <> `test`.`t`.`u`)) = 0) EXPLAIN SELECT * FROM t WHERE u=256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where false drop table t; CREATE TABLE t(u TINYINT UNSIGNED NOT NULL); INSERT INTO t VALUES (0), (3), (255); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE u=256 IS NOT NULL; u 0 3 255 SELECT * FROM t WHERE u=256 IS NULL; u SELECT * FROM t WHERE u=256 IS UNKNOWN; u SELECT * FROM t WHERE ABS(u=256)=0; u 0 3 255 SELECT * FROM t WHERE u=256; u EXPLAIN SELECT * FROM t WHERE u=256 IS NOT NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where true EXPLAIN SELECT * FROM t WHERE u=256 IS NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where false EXPLAIN SELECT * FROM t WHERE u=256 IS UNKNOWN; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where false EXPLAIN SELECT * FROM t WHERE ABS(u=256)=0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 3 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where true EXPLAIN SELECT * FROM t WHERE u=256; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`u` AS `u` from `test`.`t` where false DROP TABLE t; Constant folding in 3 way join with impossible condition due to the constant being out of range of one tables' field type. CREATE TABLE t1(i TINYINT); CREATE TABLE t2(i INT); CREATE TABLE t3(i INT); INSERT INTO t1 VALUES (127); INSERT INTO t2 VALUES (128); INSERT INTO t3 VALUES (128); ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status OK ANALYZE TABLE t3; Table Op Msg_type Msg_text test.t3 analyze status OK EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t1.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t1.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t1.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t2.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t2.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t2.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t1.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t1.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t1.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t2.i=t1.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t2.i=t1.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t2.i=t1.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t1.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t1.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t1.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t2.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t2.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t2.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t1.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t1.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t1.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t2.i=t1.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t2.i=t1.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t2.i=t1.i AND t3.i=t1.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t2.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t2.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t2.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t3.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t3.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t3.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t3.i=t2.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t3.i=t2.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t3.i AND t3.i=t2.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t3.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t3.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t3.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t2.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t2.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t2.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t3.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t3.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t3.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t3.i=t2.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t3.i=t2.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=t1.i AND t3.i=t2.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t3.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t3.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t3.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t2.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t2.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t3.i=t2.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t2.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t2.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t2.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t2.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t2.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t3.i=t2.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t2.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t2.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t2.i=t1.i AND t3.i=t2.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t2.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t2.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t2.i=t1.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t2.i=t3.i AND t1.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t2.i=t3.i AND t2.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t2.i=t3.i AND t3.i=128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=128 AND t1.i=t2.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=128 AND t1.i=t2.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false EXPLAIN SELECT * FROM t1,t2,t3 WHERE t3.i=128 AND t1.i=t2.i AND t2.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where false Constant folding in 3 way join with always true condition due to the constant being out of range of one table's field type. EXPLAIN SELECT * FROM t1,t2,t3 WHERE t1.i=t2.i AND t1.i=t3.i; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) 1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t1`.`i` = `test`.`t2`.`i`) and (`test`.`t1`.`i` = `test`.`t3`.`i`)) EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t1.i <> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) 1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i` = `test`.`t2`.`i`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t1`.`i` is not null)) EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t2.i <> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) 1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i` = `test`.`t2`.`i`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`i` is not null)) EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.i=t1.i AND t2.i=t3.i AND t3.i <> 4294967296; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) 1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (hash join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i`,`test`.`t2`.`i` AS `i`,`test`.`t3`.`i` AS `i` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i` = `test`.`t2`.`i`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`i` is not null)) DROP TABLES t1, t2, t3; CREATE TABLE t(d DECIMAL (3,1) ); INSERT INTO t VALUES (-10.5), (-10.4), (-10.3), (NULL), (10.3), (10.4), (10.5); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 NULL 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100; d EXPLAIN SELECT d FROM t WHERE d > 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100; d EXPLAIN SELECT d FROM t WHERE d >= 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d <= 100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d = 100; d EXPLAIN SELECT d FROM t WHERE d = 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE d > -100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d >= -100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d < -100; d EXPLAIN SELECT d FROM t WHERE d < -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100; d EXPLAIN SELECT d FROM t WHERE d <= -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100; d EXPLAIN SELECT d FROM t WHERE d = -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Positive constant SELECT d FROM t WHERE d > 10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.0) SELECT d FROM t WHERE d >= 10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 10.0) SELECT d FROM t WHERE d < 10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 10.0) SELECT d FROM t WHERE d <= 10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.0) SELECT d FROM t WHERE d = 10; d EXPLAIN SELECT d FROM t WHERE d = 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 14.29 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` = 10.0) SELECT d FROM t WHERE d <> 10; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <> 10.0) Negative constant SELECT d FROM t WHERE d > -10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > -10.0) SELECT d FROM t WHERE d >= -10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.0) SELECT d FROM t WHERE d < -10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.0) SELECT d FROM t WHERE d <= -10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= -10.0) SELECT d FROM t WHERE d = -10; d EXPLAIN SELECT d FROM t WHERE d = -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 14.29 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` = -10.0) SELECT d FROM t WHERE d <> -10; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <> -10.0) II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100 < d; d EXPLAIN SELECT d FROM t WHERE 100 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 <= d; d EXPLAIN SELECT d FROM t WHERE 100 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 > d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100 >= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100 = d; d EXPLAIN SELECT d FROM t WHERE 100 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE -100 < d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100 <= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100 > d; d EXPLAIN SELECT d FROM t WHERE -100 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 >= d; d EXPLAIN SELECT d FROM t WHERE -100 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 = d; d EXPLAIN SELECT d FROM t WHERE -100 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Ints inside strings SELECT d FROM t WHERE d > '10'; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > '10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.0) SELECT d FROM t WHERE d > '100'; d EXPLAIN SELECT d FROM t WHERE d > '100'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false 0x notation SELECT d FROM t WHERE d > 0x100; d EXPLAIN SELECT d FROM t WHERE d > 0x100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false DROP TABLE t; CREATE TABLE t(d DECIMAL(65, 30) ); INSERT INTO t VALUES (184467440737095516160000); INSERT INTO t VALUES (18446744073709551.3); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK 0x constant too large; gets truncated to zero SELECT * FROM t WHERE d <= 0x1FFFFFFFFFFFFFFFF; d Warnings: Warning 1292 Truncated incorrect BINARY value: 'x'01ffffffffffffffff'' EXPLAIN SELECT * FROM t WHERE d <= 0x1FFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Warning 1292 Truncated incorrect BINARY value: 'x'01ffffffffffffffff'' Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d > 0x7FFFFFFFFFFFFFFF; d 184467440737095516160000.000000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0x7FFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 9223372036854775807.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d > 0xFFFFFFFFFFFFFFFF; d 184467440737095516160000.000000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0xFFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 18446744073709551615.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d < 0x7FFFFFFFFFFFFFFF; d 18446744073709551.300000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d < 0x7FFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 9223372036854775807.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d < 0xFFFFFFFFFFFFFFFF; d 18446744073709551.300000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d < 0xFFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 18446744073709551615.000000000000000000000000000000) DROP TABLE t; CREATE TABLE t(d DECIMAL (3,1) NOT NULL); INSERT INTO t VALUES (-10.5), (-10.4), (-10.3), (0), (10.3), (10.4), (10.5); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100; d EXPLAIN SELECT d FROM t WHERE d > 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100; d EXPLAIN SELECT d FROM t WHERE d >= 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d <= 100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d = 100; d EXPLAIN SELECT d FROM t WHERE d = 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE d > -100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d >= -100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d < -100; d EXPLAIN SELECT d FROM t WHERE d < -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100; d EXPLAIN SELECT d FROM t WHERE d <= -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100; d EXPLAIN SELECT d FROM t WHERE d = -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Positive constant SELECT d FROM t WHERE d > 10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.0) SELECT d FROM t WHERE d >= 10; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 10.0) SELECT d FROM t WHERE d < 10; d -10.5 -10.4 -10.3 0.0 EXPLAIN SELECT d FROM t WHERE d < 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 10.0) SELECT d FROM t WHERE d <= 10; d -10.5 -10.4 -10.3 0.0 EXPLAIN SELECT d FROM t WHERE d <= 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.0) SELECT d FROM t WHERE d = 10; d EXPLAIN SELECT d FROM t WHERE d = 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 14.29 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` = 10.0) SELECT d FROM t WHERE d <> 10; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <> 10.0) Negative constant SELECT d FROM t WHERE d > -10; d 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > -10.0) SELECT d FROM t WHERE d >= -10; d 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.0) SELECT d FROM t WHERE d < -10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.0) SELECT d FROM t WHERE d <= -10; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= -10.0) SELECT d FROM t WHERE d = -10; d EXPLAIN SELECT d FROM t WHERE d = -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 14.29 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` = -10.0) SELECT d FROM t WHERE d <> -10; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <> -10.0) II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100 < d; d EXPLAIN SELECT d FROM t WHERE 100 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 <= d; d EXPLAIN SELECT d FROM t WHERE 100 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 > d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100 >= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100 = d; d EXPLAIN SELECT d FROM t WHERE 100 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE -100 < d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100 <= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100 > d; d EXPLAIN SELECT d FROM t WHERE -100 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 >= d; d EXPLAIN SELECT d FROM t WHERE -100 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 = d; d EXPLAIN SELECT d FROM t WHERE -100 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Ints inside strings SELECT d FROM t WHERE d > '10'; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > '10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.0) SELECT d FROM t WHERE d > '100'; d EXPLAIN SELECT d FROM t WHERE d > '100'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false 0x notation SELECT d FROM t WHERE d > 0x100; d EXPLAIN SELECT d FROM t WHERE d > 0x100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false DROP TABLE t; CREATE TABLE t(d DECIMAL(65, 30) NOT NULL); INSERT INTO t VALUES (184467440737095516160000); INSERT INTO t VALUES (18446744073709551.3); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK 0x constant too large; gets truncated to zero SELECT * FROM t WHERE d <= 0x1FFFFFFFFFFFFFFFF; d Warnings: Warning 1292 Truncated incorrect BINARY value: 'x'01ffffffffffffffff'' EXPLAIN SELECT * FROM t WHERE d <= 0x1FFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Warning 1292 Truncated incorrect BINARY value: 'x'01ffffffffffffffff'' Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d > 0x7FFFFFFFFFFFFFFF; d 184467440737095516160000.000000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0x7FFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 9223372036854775807.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d > 0xFFFFFFFFFFFFFFFF; d 184467440737095516160000.000000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0xFFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 18446744073709551615.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d < 0x7FFFFFFFFFFFFFFF; d 18446744073709551.300000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d < 0x7FFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 9223372036854775807.000000000000000000000000000000) 0x constant within bounds, expect to warnings SELECT * FROM t WHERE d < 0xFFFFFFFFFFFFFFFF; d 18446744073709551.300000000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d < 0xFFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 18446744073709551615.000000000000000000000000000000) DROP TABLE t; CREATE TABLE t(d DECIMAL (3,1) ); INSERT INTO t VALUES (-10.5), (-10.4), (-10.3), (NULL), (10.3), (10.4), (10.5); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 NULL 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100.0; d EXPLAIN SELECT d FROM t WHERE d > 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100.0; d EXPLAIN SELECT d FROM t WHERE d >= 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d <= 100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d = 100.0; d EXPLAIN SELECT d FROM t WHERE d = 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE d > -100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d >= -100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d < -100.0; d EXPLAIN SELECT d FROM t WHERE d < -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100.0; d EXPLAIN SELECT d FROM t WHERE d <= -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100.0; d EXPLAIN SELECT d FROM t WHERE d = -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100.0; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated positive constant SELECT d FROM t WHERE d > 10.31; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d >= 10.31; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d < 10.31; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE d < 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d <= 10.31; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE d <= 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d = 10.31; d EXPLAIN SELECT d FROM t WHERE d = 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 10.31; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated negative constant SELECT d FROM t WHERE d > -10.31; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d >= -10.31; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d < -10.31; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d < -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d <= -10.31; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d <= -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d = -10.31; d EXPLAIN SELECT d FROM t WHERE d = -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -10.31; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100.0 < d; d EXPLAIN SELECT d FROM t WHERE 100.0 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 <= d; d EXPLAIN SELECT d FROM t WHERE 100.0 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 > d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100.0 >= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100.0 = d; d EXPLAIN SELECT d FROM t WHERE 100.0 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE -100.0 < d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100.0 <= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100.0 > d; d EXPLAIN SELECT d FROM t WHERE -100.0 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 >= d; d EXPLAIN SELECT d FROM t WHERE -100.0 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 = d; d EXPLAIN SELECT d FROM t WHERE -100.0 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated positive constant SELECT d FROM t WHERE 10.31 < d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 <= d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 > d; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE 10.31 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 >= d; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE 10.31 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 = d; d EXPLAIN SELECT d FROM t WHERE 10.31 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 10.31 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated negative constant SELECT d FROM t WHERE -10.31 < d; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 <= d; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 > d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 >= d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 = d; d EXPLAIN SELECT d FROM t WHERE -10.31 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -10.31 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Check that leading and trailing zeros are handled SELECT d FROM t WHERE d > 10.30; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.30; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d > 010.3; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 010.3; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) Check decimals hidden inside strings SELECT d FROM t WHERE d > '-10.31'; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > '-10.31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) Cruft inside string, MySQL interprets as 0 with warning SELECT d FROM t WHERE d > 'A'; d 10.3 10.4 10.5 Warnings: Warning 1292 Truncated incorrect DECIMAL value: 'A' EXPLAIN SELECT d FROM t WHERE d > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Warning 1292 Truncated incorrect DECIMAL value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) DROP TABLE t; Check that #digits in constant fraction is widenened as for fields CREATE TABLE t(d DECIMAL(65,30)); INSERT INTO t VALUES (10.34999), (10.350001); SELECT * FROM t WHERE d > 10.35; d 10.350001000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 10.35; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.350000000000000000000000000000) DROP TABLE t; CREATE TABLE t(d DECIMAL (3,1) NOT NULL); INSERT INTO t VALUES (-10.5), (-10.4), (-10.3), (0), (10.3), (10.4), (10.5); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100.0; d EXPLAIN SELECT d FROM t WHERE d > 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100.0; d EXPLAIN SELECT d FROM t WHERE d >= 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d <= 100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d = 100.0; d EXPLAIN SELECT d FROM t WHERE d = 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE d > -100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d >= -100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d < -100.0; d EXPLAIN SELECT d FROM t WHERE d < -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100.0; d EXPLAIN SELECT d FROM t WHERE d <= -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100.0; d EXPLAIN SELECT d FROM t WHERE d = -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100.0; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated positive constant SELECT d FROM t WHERE d > 10.31; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d >= 10.31; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d < 10.31; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE d < 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d <= 10.31; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE d <= 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d = 10.31; d EXPLAIN SELECT d FROM t WHERE d = 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 10.31; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated negative constant SELECT d FROM t WHERE d > -10.31; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d >= -10.31; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d < -10.31; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d < -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d <= -10.31; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d <= -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d = -10.31; d EXPLAIN SELECT d FROM t WHERE d = -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -10.31; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10.31; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100.0 < d; d EXPLAIN SELECT d FROM t WHERE 100.0 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 <= d; d EXPLAIN SELECT d FROM t WHERE 100.0 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 > d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100.0 >= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100.0 = d; d EXPLAIN SELECT d FROM t WHERE 100.0 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE -100.0 < d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100.0 <= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100.0 > d; d EXPLAIN SELECT d FROM t WHERE -100.0 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 >= d; d EXPLAIN SELECT d FROM t WHERE -100.0 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 = d; d EXPLAIN SELECT d FROM t WHERE -100.0 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated positive constant SELECT d FROM t WHERE 10.31 < d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 <= d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 > d; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE 10.31 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 >= d; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE 10.31 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31 = d; d EXPLAIN SELECT d FROM t WHERE 10.31 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 10.31 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated negative constant SELECT d FROM t WHERE -10.31 < d; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 <= d; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 > d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 >= d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31 = d; d EXPLAIN SELECT d FROM t WHERE -10.31 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -10.31 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Check that leading and trailing zeros are handled SELECT d FROM t WHERE d > 10.30; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.30; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d > 010.3; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 010.3; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) Check decimals hidden inside strings SELECT d FROM t WHERE d > '-10.31'; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > '-10.31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) Cruft inside string, MySQL interprets as 0 with warning SELECT d FROM t WHERE d > 'A'; d 10.3 10.4 10.5 Warnings: Warning 1292 Truncated incorrect DECIMAL value: 'A' EXPLAIN SELECT d FROM t WHERE d > 'A'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Warning 1292 Truncated incorrect DECIMAL value: 'A' Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) DROP TABLE t; Check that #digits in constant fraction is widenened as for fields CREATE TABLE t(d DECIMAL(65,30)); INSERT INTO t VALUES (10.34999), (10.350001); SELECT * FROM t WHERE d > 10.35; d 10.350001000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 10.35; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.350000000000000000000000000000) DROP TABLE t; create table t(d decimal (3,1) ); insert into t values (-10.5), (-10.4), (-10.3), (NULL), (10.3), (10.4), (10.5); analyze table t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 NULL 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100.0E00; d EXPLAIN SELECT d FROM t WHERE d > 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100.0E00; d EXPLAIN SELECT d FROM t WHERE d >= 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d <= 100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d = 100.0E00; d EXPLAIN SELECT d FROM t WHERE d = 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE d > -100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d >= -100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d < -100.0E00; d EXPLAIN SELECT d FROM t WHERE d < -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100.0E00; d EXPLAIN SELECT d FROM t WHERE d <= -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100.0E00; d EXPLAIN SELECT d FROM t WHERE d = -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100.0E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated positive constant SELECT d FROM t WHERE d > 10.31E00; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d >= 10.31E00; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d < 10.31E00; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE d < 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d <= 10.31E00; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE d <= 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d = 10.31E00; d EXPLAIN SELECT d FROM t WHERE d = 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 10.31E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated negative constant SELECT d FROM t WHERE d > -10.31E00; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d >= -10.31E00; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d < -10.31E00; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d < -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d <= -10.31E00; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d <= -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d = -10.31E00; d EXPLAIN SELECT d FROM t WHERE d = -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -10.31E00; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100.0E00 < d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 <= d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 > d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100.0E00 >= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE 100.0E00 = d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Out of range, negative constant SELECT d FROM t WHERE -100.0E00 < d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100.0E00 <= d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE -100.0E00 > d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 >= d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 = d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated positive constant SELECT d FROM t WHERE 10.31E00 < d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 <= d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 > d; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE 10.31E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 >= d; d -10.5 -10.4 -10.3 10.3 EXPLAIN SELECT d FROM t WHERE 10.31E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 = d; d EXPLAIN SELECT d FROM t WHERE 10.31E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 10.31E00 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Truncated negative constant SELECT d FROM t WHERE -10.31E00 < d; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 <= d; d -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 > d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 >= d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 = d; d EXPLAIN SELECT d FROM t WHERE -10.31E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -10.31E00 <> d; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Check real underflow SELECT d FROM t WHERE d > 1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) SELECT d FROM t WHERE d >= 1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) SELECT d FROM t WHERE d < 1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.0) SELECT d FROM t WHERE d <= 1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.0) SELECT d FROM t WHERE d = 1.0E-100; d EXPLAIN SELECT d FROM t WHERE d = 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 1.0E-100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) SELECT d FROM t WHERE d > -1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 0.0) SELECT d FROM t WHERE d >= -1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 0.0) SELECT d FROM t WHERE d < -1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 0.0) SELECT d FROM t WHERE d <= -1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 0.0) SELECT d FROM t WHERE d = -1.0E-100; d EXPLAIN SELECT d FROM t WHERE d = -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -1.0E-100; d -10.5 -10.4 -10.3 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 85.71 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) Test that reals inside strings are handled ok SELECT d FROM t WHERE d < '1.0E0'; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < '1.0E0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 1.0) DROP TABLE t; Check that #digits in constant fraction is widenened as for fields CREATE TABLE t(d DECIMAL(65,30)); INSERT INTO t VALUES (10.34999), (10.350001); SELECT * FROM t WHERE d > 0.1035E02; d 10.350001000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0.1035E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.350000000000000000000000000000) DROP TABLE t; create table t(d decimal (3,1) NOT NULL); insert into t values (-10.5), (-10.4), (-10.3), (0), (10.3), (10.4), (10.5); analyze table t; Table Op Msg_type Msg_text test.t analyze status OK SELECT d FROM t; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 II.a.1 field cmp constant Out of range, positive constant SELECT d FROM t WHERE d > 100.0E00; d EXPLAIN SELECT d FROM t WHERE d > 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d >= 100.0E00; d EXPLAIN SELECT d FROM t WHERE d >= 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d < 100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d < 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d <= 100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <= 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d = 100.0E00; d EXPLAIN SELECT d FROM t WHERE d = 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE d > -100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d >= -100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d < -100.0E00; d EXPLAIN SELECT d FROM t WHERE d < -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <= -100.0E00; d EXPLAIN SELECT d FROM t WHERE d <= -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d = -100.0E00; d EXPLAIN SELECT d FROM t WHERE d = -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -100.0E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -100.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated positive constant SELECT d FROM t WHERE d > 10.31E00; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d >= 10.31E00; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.3) SELECT d FROM t WHERE d < 10.31E00; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE d < 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d <= 10.31E00; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE d <= 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 10.3) SELECT d FROM t WHERE d = 10.31E00; d EXPLAIN SELECT d FROM t WHERE d = 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 10.31E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated negative constant SELECT d FROM t WHERE d > -10.31E00; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d >= -10.31E00; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= -10.3) SELECT d FROM t WHERE d < -10.31E00; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d < -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d <= -10.31E00; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE d <= -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < -10.3) SELECT d FROM t WHERE d = -10.31E00; d EXPLAIN SELECT d FROM t WHERE d = -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -10.31E00; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -10.31E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true II.a.2 constant cmp field Out of range, positive constant SELECT d FROM t WHERE 100.0E00 < d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 <= d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 > d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100.0E00 >= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE 100.0E00 = d; d EXPLAIN SELECT d FROM t WHERE 100.0E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 100.0E00 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 100.0E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Out of range, negative constant SELECT d FROM t WHERE -100.0E00 < d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100.0E00 <= d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE -100.0E00 > d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 >= d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 = d; d EXPLAIN SELECT d FROM t WHERE -100.0E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -100.0E00 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -100.0E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated positive constant SELECT d FROM t WHERE 10.31E00 < d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 <= d; d 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 < `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 > d; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE 10.31E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 >= d; d -10.5 -10.4 -10.3 0.0 10.3 EXPLAIN SELECT d FROM t WHERE 10.31E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (10.3 >= `test`.`t`.`d`) SELECT d FROM t WHERE 10.31E00 = d; d EXPLAIN SELECT d FROM t WHERE 10.31E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE 10.31E00 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE 10.31E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Truncated negative constant SELECT d FROM t WHERE -10.31E00 < d; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 < d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 <= d; d -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 <= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 <= `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 > d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31E00 > d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 >= d; d -10.5 -10.4 EXPLAIN SELECT d FROM t WHERE -10.31E00 >= d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (-10.3 > `test`.`t`.`d`) SELECT d FROM t WHERE -10.31E00 = d; d EXPLAIN SELECT d FROM t WHERE -10.31E00 = d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE -10.31E00 <> d; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE -10.31E00 <> d; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Check real underflow SELECT d FROM t WHERE d > 1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) SELECT d FROM t WHERE d >= 1.0E-100; d 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0.0) SELECT d FROM t WHERE d < 1.0E-100; d -10.5 -10.4 -10.3 0.0 EXPLAIN SELECT d FROM t WHERE d < 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.0) SELECT d FROM t WHERE d <= 1.0E-100; d -10.5 -10.4 -10.3 0.0 EXPLAIN SELECT d FROM t WHERE d <= 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0.0) SELECT d FROM t WHERE d = 1.0E-100; d EXPLAIN SELECT d FROM t WHERE d = 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> 1.0E-100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> 1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true SELECT d FROM t WHERE d > -1.0E-100; d 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d > -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 0.0) SELECT d FROM t WHERE d >= -1.0E-100; d 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d >= -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 0.0) SELECT d FROM t WHERE d < -1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d < -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 0.0) SELECT d FROM t WHERE d <= -1.0E-100; d -10.5 -10.4 -10.3 EXPLAIN SELECT d FROM t WHERE d <= -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 0.0) SELECT d FROM t WHERE d = -1.0E-100; d EXPLAIN SELECT d FROM t WHERE d = -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false SELECT d FROM t WHERE d <> -1.0E-100; d -10.5 -10.4 -10.3 0.0 10.3 10.4 10.5 EXPLAIN SELECT d FROM t WHERE d <> -1.0E-100; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where true Test that reals inside strings are handled ok SELECT d FROM t WHERE d < '1.0E0'; d -10.5 -10.4 -10.3 0.0 EXPLAIN SELECT d FROM t WHERE d < '1.0E0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 7 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 1.0) DROP TABLE t; Check that #digits in constant fraction is widenened as for fields CREATE TABLE t(d DECIMAL(65,30)); INSERT INTO t VALUES (10.34999), (10.350001); SELECT * FROM t WHERE d > 0.1035E02; d 10.350001000000000000000000000000 EXPLAIN SELECT * FROM t WHERE d > 0.1035E02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 50.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 10.350000000000000000000000000000) DROP TABLE t; AD-158 Folding of IS NOT NULL if argument is not nullable. CREATE TABLE t(i INT NOT NULL); EXPLAIN SELECT * FROM t WHERE i IS NOT NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where true SELECT * FROM t WHERE i IS NOT NULL; i INSERT INTO t VALUES (3), (4); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE i IS NOT NULL; i 3 4 EXPLAIN SELECT * FROM t WHERE i IS NOT NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where true EXPLAIN SELECT * FROM t WHERE ABS(i IS NOT NULL); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where true DROP TABLE t; Bug in nested condition: expression interior folding didn't materialize a TRUE in the case of the field being not nullable. Interior foldings should always materialize. CREATE TABLE t(i TINYINT NOT NULL); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK INSERT INTO t VALUES (10),(100),(1),(0); EXPLAIN SELECT * FROM t WHERE i = (i < 255); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` = true) SELECT * FROM t WHERE i = (i < 255); i 1 DROP TABLE t; CREATE TABLE t(i TINYINT); INSERT INTO t VALUES (10),(100),(1),(0),(NULL); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK EXPLAIN SELECT * FROM t WHERE i = (i < 255); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 5 20.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (`test`.`t`.`i` = if((`test`.`t`.`i` is null),NULL,1)) SELECT * FROM t WHERE i = (i < 255); i 1 Bug#29179604 EXPLAIN SELECT * FROM t WHERE 1 = (i < 255); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (1 = if((`test`.`t`.`i` is null),NULL,1)) SELECT * FROM t WHERE 1 = (i < 255); i 10 100 1 0 Used to give wrong result: NULL/UNKNOWN was lost in folding EXPLAIN SELECT * FROM t WHERE 0 = (i < 255); id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`i` AS `i` from `test`.`t` where (0 = if((`test`.`t`.`i` is null),NULL,1)) SELECT * FROM t WHERE 0 = (i < 255); i DROP TABLE t; CREATE TABLE t(d DECIMAL(65,0)); EXPLAIN SELECT d FROM t WHERE d < 45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d = 45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d != 45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d > 45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d < -45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d = -45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d != -45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d > -45.34e306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d < 45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` <= 0) EXPLAIN SELECT d FROM t WHERE d = 45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d != 45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d > 45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` > 0) EXPLAIN SELECT d FROM t WHERE d < -45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` < 0) EXPLAIN SELECT d FROM t WHERE d = -45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where false EXPLAIN SELECT d FROM t WHERE d != -45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` is not null) EXPLAIN SELECT d FROM t WHERE d > -45.34e-306; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`d` AS `d` from `test`.`t` where (`test`.`t`.`d` >= 0) DROP TABLE t; # # Tests with type FLOAT(5,2) against real constants # CREATE TABLE float_5_2_tbl (colA FLOAT(5,2) ); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. INSERT INTO float_5_2_tbl VALUES (-999.99), (-999.985), (-999.984), ( 3.3), (0.0), (3.3), (999.985), (999.984), (999.99), (NULL); ANALYZE TABLE float_5_2_tbl; Table Op Msg_type Msg_text test.float_5_2_tbl analyze status OK SELECT * FROM float_5_2_tbl; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 NULL SELECT * FROM float_5_2_tbl WHERE colA <= -999.99; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < -999.99; colA SELECT * FROM float_5_2_tbl WHERE colA >= -999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > -999.99; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = -999.99; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA <> -999.99; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= -999.984; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < -999.984; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA >= -999.984; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > -999.984; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = -999.984; colA SELECT * FROM float_5_2_tbl WHERE colA <> -999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= -999.985; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < -999.985; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA >= -999.985; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > -999.985; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = -999.985; colA SELECT * FROM float_5_2_tbl WHERE colA <> -999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= -999.995; colA SELECT * FROM float_5_2_tbl WHERE colA < -999.995; colA SELECT * FROM float_5_2_tbl WHERE colA >= -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = -999.995; colA SELECT * FROM float_5_2_tbl WHERE colA <> -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= -999.994; colA SELECT * FROM float_5_2_tbl WHERE colA < -999.994; colA SELECT * FROM float_5_2_tbl WHERE colA >= -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = -999.994; colA SELECT * FROM float_5_2_tbl WHERE colA <> -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= 999.99; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 999.99; colA SELECT * FROM float_5_2_tbl WHERE colA = 999.99; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA <> 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA <= 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= 999.984; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 999.984; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 999.984; colA SELECT * FROM float_5_2_tbl WHERE colA <> 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= 999.985; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 999.985; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 999.985; colA SELECT * FROM float_5_2_tbl WHERE colA <> 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM float_5_2_tbl WHERE colA >= 999.994; colA SELECT * FROM float_5_2_tbl WHERE colA > 999.994; colA SELECT * FROM float_5_2_tbl WHERE colA = 999.994; colA SELECT * FROM float_5_2_tbl WHERE colA <> 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA >= 999.995; colA SELECT * FROM float_5_2_tbl WHERE colA > 999.995; colA SELECT * FROM float_5_2_tbl WHERE colA = 999.995; colA SELECT * FROM float_5_2_tbl WHERE colA <> 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) DROP TABLE float_5_2_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with type FLOAT(5,2) against real constants # CREATE TABLE float_5_2_tbl (colA FLOAT(5,2) ); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. INSERT INTO float_5_2_tbl VALUES ('-999.99'), ('-999.985'), ('-999.984'), ( 3.3), (0.0), (3.3), ('999.985'), ('999.984'), ('999.99'), (NULL); ANALYZE TABLE float_5_2_tbl; Table Op Msg_type Msg_text test.float_5_2_tbl analyze status OK SELECT * FROM float_5_2_tbl; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 NULL SELECT * FROM float_5_2_tbl WHERE colA <= '-999.99'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < '-999.99'; colA SELECT * FROM float_5_2_tbl WHERE colA >= '-999.99'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '-999.99'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '-999.99'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA <> '-999.99'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '-999.984'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < '-999.984'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA >= '-999.984'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '-999.984'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '-999.984'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '-999.984'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '-999.985'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA < '-999.985'; colA -999.99 -999.99 SELECT * FROM float_5_2_tbl WHERE colA >= '-999.985'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '-999.985'; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '-999.985'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '-999.985'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '-999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA < '-999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA >= '-999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '-999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '-999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '-999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '-999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA < '-999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA >= '-999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '-999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '-999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '-999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.99'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.99'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.99'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.99'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.99'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA <> '999.99'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA <= '999.984'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < '999.984'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.984'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.984'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '999.984'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.984'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.985'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < '999.985'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.985'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.985'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '999.985'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.985'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM float_5_2_tbl WHERE colA >= '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA > '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.994'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA >= '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA > '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.995'; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '-999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '-999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '-999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '-999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= -999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '-999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) DROP TABLE float_5_2_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with UNSIGNED type FLOAT(5,2) against real constants # CREATE TABLE float_5_2_tbl (colA FLOAT(5,2) UNSIGNED ); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. INSERT INTO float_5_2_tbl VALUES (0.0), (0.005), (0.004), ( 3.3), (0.0), (3.3), ('999.985'), ('999.984'), ('999.99'), (NULL); ANALYZE TABLE float_5_2_tbl; Table Op Msg_type Msg_text test.float_5_2_tbl analyze status OK SELECT * FROM float_5_2_tbl; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 NULL SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA < 0.0; colA SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 0.004; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA < 0.004; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA >= 0.004; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 0.004; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 0.004; colA SELECT * FROM float_5_2_tbl WHERE colA <> 0.004; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 0.005; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA < 0.005; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA >= 0.005; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 0.005; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 0.005; colA SELECT * FROM float_5_2_tbl WHERE colA <> 0.005; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA < 0.0; colA SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA < 0.0; colA SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA > 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA = 0.0; colA 0.00 0.00 0.00 0.00 SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; colA 3.30 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.99'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.99'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.99'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.99'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.99'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA <> '999.99'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA <= '999.984'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < '999.984'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.984'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.984'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '999.984'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.984'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.985'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA < '999.985'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.98 SELECT * FROM float_5_2_tbl WHERE colA >= '999.985'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA > '999.985'; colA 999.99 999.99 SELECT * FROM float_5_2_tbl WHERE colA = '999.985'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.985'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.994'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.994'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM float_5_2_tbl WHERE colA >= '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA > '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.994'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.994'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA <= '999.995'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA < '999.995'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM float_5_2_tbl WHERE colA >= '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA > '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA = '999.995'; colA SELECT * FROM float_5_2_tbl WHERE colA <> '999.995'; colA 0.00 0.00 0.00 3.30 0.00 3.30 999.99 999.98 999.99 EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 0.004; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 0.005; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 0) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` = 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.99'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <> 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.97998046875) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.984'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` < 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` >= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.985'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` <= 999.989990234375) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` > 999.989990234375) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.994'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <= '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA < '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA >= '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA > '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA = '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where false EXPLAIN SELECT * FROM float_5_2_tbl WHERE colA <> '999.995'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_5_2_tbl`.`colA` AS `colA` from `test`.`float_5_2_tbl` where (`test`.`float_5_2_tbl`.`colA` is not null) DROP TABLE float_5_2_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with type FLOAT against real constants # CREATE TABLE float_tbl (colA FLOAT ); INSERT INTO float_tbl VALUES (-3.4028234663852886e+38), (-3.4028234663852886e+38), (-3.4028234663852886e+38), ( 3.3), (0.0), (3.3), (3.4028234663852886e+38), (3.4028234663852886e+38), (3.402823466E+38), (NULL); ANALYZE TABLE float_tbl; Table Op Msg_type Msg_text test.float_tbl analyze status OK SELECT * FROM float_tbl; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 NULL SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; colA SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; colA SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; colA SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA < -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA >= -3.402823466385288E+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > -3.402823466385288E+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = -3.402823466385288E+38; colA SELECT * FROM float_tbl WHERE colA <> -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA < -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 SELECT * FROM float_tbl WHERE colA >= -3.402823466385288E+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > -3.402823466385288E+38; colA 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = -3.402823466385288E+38; colA SELECT * FROM float_tbl WHERE colA <> -3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= 3.402823466E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA < 3.402823466E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA >= 3.402823466E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > 3.402823466E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = 3.402823466E+38; colA SELECT * FROM float_tbl WHERE colA <> 3.402823466E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA < 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA >= 3.4028234663852886e+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > 3.4028234663852886e+38; colA SELECT * FROM float_tbl WHERE colA = 3.4028234663852886e+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <> 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA <= 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA < 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA >= 3.4028234663852886e+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > 3.4028234663852886e+38; colA SELECT * FROM float_tbl WHERE colA = 3.4028234663852886e+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <> 3.4028234663852886e+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA <= 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA < 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM float_tbl WHERE colA >= 3.402823466385288E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > 3.402823466385288E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = 3.402823466385288E+38; colA SELECT * FROM float_tbl WHERE colA <> 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA <= 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA < 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 SELECT * FROM float_tbl WHERE colA >= 3.402823466385288E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA > 3.402823466385288E+38; colA 3.40282e38 3.40282e38 3.40282e38 SELECT * FROM float_tbl WHERE colA = 3.402823466385288E+38; colA SELECT * FROM float_tbl WHERE colA <> 3.402823466385288E+38; colA -3.40282e38 -3.40282e38 -3.40282e38 3.3 0 3.3 3.40282e38 3.40282e38 3.40282e38 EXPLAIN SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA < -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA > -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA = -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> -3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> -3.4028234663852886e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA < -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA > -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA = -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA < -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA > -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA = -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> -3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> -3.402823466385288e38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA < 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA > 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA = 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> 3.402823466E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> 3.402823466E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA < 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA > 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA = 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA < 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA > 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA = 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> 3.4028234663852886e+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> 3.4028234663852886e+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA < 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < 3.402823466385288E+38) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM float_tbl WHERE colA >= 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA > 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA = 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <= 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <= 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA < 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` < 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA >= 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` >= 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA > 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` > 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA = 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` = 3.402823466385288E+38) EXPLAIN SELECT * FROM float_tbl WHERE colA <> 3.402823466385288E+38; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE float_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`float_tbl`.`colA` AS `colA` from `test`.`float_tbl` where (`test`.`float_tbl`.`colA` <> 3.402823466385288E+38) DROP TABLE float_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with type DOUBLE(5,2) against real constants # CREATE TABLE double_5_2_tbl (colA DOUBLE(5,2) ); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. INSERT INTO double_5_2_tbl VALUES (-999.99), (-999.985), (-999.984), ( 3.3), (0.0), (3.3), (999.985), (999.984), (999.99), (NULL); ANALYZE TABLE double_5_2_tbl; Table Op Msg_type Msg_text test.double_5_2_tbl analyze status OK SELECT * FROM double_5_2_tbl; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 NULL SELECT * FROM double_5_2_tbl WHERE colA <= -999.99; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA < -999.99; colA SELECT * FROM double_5_2_tbl WHERE colA >= -999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA > -999.99; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA = -999.99; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA <> -999.99; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= -999.984; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA < -999.984; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA >= -999.984; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA > -999.984; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA = -999.984; colA SELECT * FROM double_5_2_tbl WHERE colA <> -999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= -999.985; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA < -999.985; colA -999.99 -999.99 SELECT * FROM double_5_2_tbl WHERE colA >= -999.985; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA > -999.985; colA -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA = -999.985; colA SELECT * FROM double_5_2_tbl WHERE colA <> -999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= -999.995; colA SELECT * FROM double_5_2_tbl WHERE colA < -999.995; colA SELECT * FROM double_5_2_tbl WHERE colA >= -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA > -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA = -999.995; colA SELECT * FROM double_5_2_tbl WHERE colA <> -999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= -999.994; colA SELECT * FROM double_5_2_tbl WHERE colA < -999.994; colA SELECT * FROM double_5_2_tbl WHERE colA >= -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA > -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA = -999.994; colA SELECT * FROM double_5_2_tbl WHERE colA <> -999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA < 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA >= 999.99; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA > 999.99; colA SELECT * FROM double_5_2_tbl WHERE colA = 999.99; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA <> 999.99; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA <= 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA < 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA >= 999.984; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA > 999.984; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA = 999.984; colA SELECT * FROM double_5_2_tbl WHERE colA <> 999.984; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA < 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.98 SELECT * FROM double_5_2_tbl WHERE colA >= 999.985; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA > 999.985; colA 999.99 999.99 SELECT * FROM double_5_2_tbl WHERE colA = 999.985; colA SELECT * FROM double_5_2_tbl WHERE colA <> 999.985; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA < 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM double_5_2_tbl WHERE colA >= 999.994; colA SELECT * FROM double_5_2_tbl WHERE colA > 999.994; colA SELECT * FROM double_5_2_tbl WHERE colA = 999.994; colA SELECT * FROM double_5_2_tbl WHERE colA <> 999.994; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA <= 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA < 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 SELECT * FROM double_5_2_tbl WHERE colA >= 999.995; colA SELECT * FROM double_5_2_tbl WHERE colA > 999.995; colA SELECT * FROM double_5_2_tbl WHERE colA = 999.995; colA SELECT * FROM double_5_2_tbl WHERE colA <> 999.995; colA -999.99 -999.99 -999.98 3.30 0.00 3.30 999.99 999.98 999.99 EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` = -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> -999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <> -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < -999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < -999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= -999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= -999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> -999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> -999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> -999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= -999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> -999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` = 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> 999.99; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <> 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= 999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= 999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > 999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > 999.98) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> 999.984; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` < 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` >= 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> 999.985; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` <= 999.99) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` > 999.99) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> 999.994; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <= 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA < 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA >= 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA > 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA = 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where false EXPLAIN SELECT * FROM double_5_2_tbl WHERE colA <> 999.995; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_5_2_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_5_2_tbl`.`colA` AS `colA` from `test`.`double_5_2_tbl` where (`test`.`double_5_2_tbl`.`colA` is not null) DROP TABLE double_5_2_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with type DOUBLE against real constants # CREATE TABLE double_tbl (colA DOUBLE ); INSERT INTO double_tbl VALUES (-1.7976931348623157E+308), (-1.7976931348623156E+308), (-1.7976931348623156E+308), ( 3.3), (0.0), (3.3), (1.7976931348623156E+308), (1.7976931348623156E+308), (1.7976931348623157E+308), (NULL); ANALYZE TABLE double_tbl; Table Op Msg_type Msg_text test.double_tbl analyze status OK SELECT * FROM double_tbl; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 NULL SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= -1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < -1.7976931348623156E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA >= -1.7976931348623156E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > -1.7976931348623156E+308; colA 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = -1.7976931348623156E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> -1.7976931348623156E+308; colA -1.7976931348623157e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= -1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < -1.7976931348623156E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA >= -1.7976931348623156E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > -1.7976931348623156E+308; colA 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = -1.7976931348623156E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> -1.7976931348623156E+308; colA -1.7976931348623157e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <= 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 SELECT * FROM double_tbl WHERE colA >= 1.7976931348623156E+308; colA 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > 1.7976931348623156E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = 1.7976931348623156E+308; colA 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 SELECT * FROM double_tbl WHERE colA >= 1.7976931348623156E+308; colA 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > 1.7976931348623156E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = 1.7976931348623156E+308; colA 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> 1.7976931348623156E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; colA SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 EXPLAIN SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> -1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> -1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA < 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA > 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA = 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA < 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA > 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA = 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> 1.7976931348623156E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623156E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157E+308) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA < 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA > 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA = 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157E+308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> 1.7976931348623157E+308; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157E+308) DROP TABLE double_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; # # Tests with type DOUBLE against real constants # CREATE TABLE double_tbl (colA DOUBLE ); INSERT INTO double_tbl VALUES ('-1.7976931348623157E+308'), ('-1.7976931348623156E+308'), ('-1.7976931348623156E+308'), ( 3.3), (0.0), (3.3), ('1.7976931348623156E+308'), ('1.7976931348623156E+308'), ('1.7976931348623157E+308'), (NULL); ANALYZE TABLE double_tbl; Table Op Msg_type Msg_text test.double_tbl analyze status OK SELECT * FROM double_tbl; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 NULL SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < '-1.7976931348623156E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623156E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '-1.7976931348623156E+308'; colA 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '-1.7976931348623156E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623156E+308'; colA -1.7976931348623157e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < '-1.7976931348623156E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623156E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '-1.7976931348623156E+308'; colA 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '-1.7976931348623156E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623156E+308'; colA -1.7976931348623157e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; colA -1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; colA -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <= '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 SELECT * FROM double_tbl WHERE colA >= '1.7976931348623156E+308'; colA 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '1.7976931348623156E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '1.7976931348623156E+308'; colA 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA < '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 SELECT * FROM double_tbl WHERE colA >= '1.7976931348623156E+308'; colA 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '1.7976931348623156E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA = '1.7976931348623156E+308'; colA 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <> '1.7976931348623156E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 Result here can be empty set, because MySQL performs operation in double, e.g. colA >= 999.994 for FLOAT(5,2): executes as nnn.nn0 >= 999.994, i.e. the .994 isn't truncated to .99 before comparison SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; colA SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; colA 1.7976931348623157e308 SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; colA -1.7976931348623157e308 -1.7976931348623155e308 -1.7976931348623155e308 3.3 0 3.3 1.7976931348623155e308 1.7976931348623155e308 EXPLAIN SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '-1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> -1.797693134862316e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '1.7976931348623156E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623155e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157e308) Cf explanation of semantics here under the SELECT above. The operator is modified here to get the same semantics: we need > instead of >= since we truncate the constant to the allowed range EXPLAIN SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA < '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` < 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA >= '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` >= 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA > '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` > 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA = '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 10.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` = 1.7976931348623157e308) EXPLAIN SELECT * FROM double_tbl WHERE colA <> '1.7976931348623157E+308'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE double_tbl NULL ALL NULL NULL NULL NULL 10 90.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`double_tbl`.`colA` AS `colA` from `test`.`double_tbl` where (`test`.`double_tbl`.`colA` <> 1.7976931348623157e308) DROP TABLE double_tbl; CREATE TABLE f(f FLOAT); INSERT INTO f VALUES (-1), (2); SELECT * FROM f WHERE f >= '2 garbage'; f 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: '2 garbage' DROP TABLE f; CREATE TABLE f(f FLOAT); CREATE TABLE f_fix(f FLOAT(5,2)); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. CREATE TABLE d(d DOUBLE); CREATE TABLE d_fix(d DOUBLE(5,2)); Warnings: Warning 1681 Specifying number of digits for floating point data types is deprecated and will be removed in a future release. INSERT INTO f VALUES (-3.4028234663852886e+38), (0), (3.4028234663852886e+38); INSERT INTO f_fix VALUES (-999.00), (0), (999.99); INSERT INTO d VALUES (-1.7976931348623157E+308), (0), (1.7976931348623157E+308); INSERT INTO d_fix VALUES (-999.00), (0), (999.99); ANALYZE TABLE f; Table Op Msg_type Msg_text test.f analyze status OK ANALYZE TABLE f_fix; Table Op Msg_type Msg_text test.f_fix analyze status OK ANALYZE TABLE d; Table Op Msg_type Msg_text test.d analyze status OK ANALYZE TABLE d_fix; Table Op Msg_type Msg_text test.d_fix analyze status OK # With float we should see folding SELECT * FROM f WHERE f < 99999999999999999999999999999999999999999999999999999999999999999.0; f -3.40282e38 0 3.40282e38 EXPLAIN SELECT * FROM f WHERE f < 99999999999999999999999999999999999999999999999999999999999999999.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE f NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`f`.`f` AS `f` from `test`.`f` where (`test`.`f`.`f` is not null) # With double, only type adjustment SELECT * FROM d WHERE d < 99999999999999999999999999999999999999999999999999999999999999999.0; d -1.7976931348623157e308 0 EXPLAIN SELECT * FROM d WHERE d < 99999999999999999999999999999999999999999999999999999999999999999.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE d NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`d`.`d` AS `d` from `test`.`d` where (`test`.`d`.`d` < 1e65) # Check around max float in decimal SELECT * FROM f WHERE f < 100000000000000000000000000000000000000.0; f -3.40282e38 0 EXPLAIN SELECT * FROM f WHERE f < 100000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE f NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`f`.`f` AS `f` from `test`.`f` where (`test`.`f`.`f` < 1e38) SELECT * FROM f WHERE f > 100000000000000000000000000000000000000.0; f 3.40282e38 EXPLAIN SELECT * FROM f WHERE f > 100000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE f NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`f`.`f` AS `f` from `test`.`f` where (`test`.`f`.`f` > 1e38) SELECT * FROM f WHERE f < 1000000000000000000000000000000000000000.0; f -3.40282e38 0 3.40282e38 EXPLAIN SELECT * FROM f WHERE f < 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE f NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`f`.`f` AS `f` from `test`.`f` where (`test`.`f`.`f` is not null) SELECT * FROM f WHERE f > 1000000000000000000000000000000000000000.0; f EXPLAIN SELECT * FROM f WHERE f > 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`f`.`f` AS `f` from `test`.`f` where false # Then compare with a DOUBLE field SELECT * FROM d WHERE d < 1000000000000000000000000000000000000000.0; d -1.7976931348623157e308 0 EXPLAIN SELECT * FROM d WHERE d < 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE d NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`d`.`d` AS `d` from `test`.`d` where (`test`.`d`.`d` < 1e39) SELECT * FROM d WHERE d > 1000000000000000000000000000000000000000.0; d 1.7976931348623157e308 EXPLAIN SELECT * FROM d WHERE d > 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE d NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`d`.`d` AS `d` from `test`.`d` where (`test`.`d`.`d` > 1e39) Then with the two fixed real type fields, both of which should be folded SELECT * FROM f_fix WHERE f < 1000000000000000000000000000000000000000.0; f -999.00 0.00 999.99 EXPLAIN SELECT * FROM f_fix WHERE f < 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE f_fix NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`f_fix`.`f` AS `f` from `test`.`f_fix` where (`test`.`f_fix`.`f` is not null) SELECT * FROM f_fix WHERE f > 1000000000000000000000000000000000000000.0; f EXPLAIN SELECT * FROM f_fix WHERE f > 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`f_fix`.`f` AS `f` from `test`.`f_fix` where false SELECT * FROM d_fix WHERE d < 1000000000000000000000000000000000000000.0; d -999.00 0.00 999.99 EXPLAIN SELECT * FROM d_fix WHERE d < 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE d_fix NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`d_fix`.`d` AS `d` from `test`.`d_fix` where (`test`.`d_fix`.`d` is not null) SELECT * FROM d_fix WHERE d > 1000000000000000000000000000000000000000.0; d EXPLAIN SELECT * FROM d_fix WHERE d > 1000000000000000000000000000000000000000.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`d_fix`.`d` AS `d` from `test`.`d_fix` where false DROP TABLE f, f_fix, d, d_fix; # I N T constant CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0; y SELECT * FROM tbl_year WHERE y <= 0; y 0000 SELECT * FROM tbl_year WHERE y > 0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0; y 0000 SELECT * FROM tbl_year WHERE y <> 0; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1; y SELECT * FROM tbl_year WHERE y <= -1; y SELECT * FROM tbl_year WHERE y > -1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1; y SELECT * FROM tbl_year WHERE y <> -1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1; y SELECT * FROM tbl_year WHERE y <> 1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300; y 0000 SELECT * FROM tbl_year WHERE y <= 300; y 0000 SELECT * FROM tbl_year WHERE y > 300; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300; y SELECT * FROM tbl_year WHERE y <> 300; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900; y 0000 SELECT * FROM tbl_year WHERE y <= 1900; y 0000 SELECT * FROM tbl_year WHERE y > 1900; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900; y SELECT * FROM tbl_year WHERE y <> 1900; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1901; y 0000 SELECT * FROM tbl_year WHERE y <= 1901; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1901; y 1901 SELECT * FROM tbl_year WHERE y <> 1901; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1902; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902; y SELECT * FROM tbl_year WHERE y <> 1902; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 2018; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 2018; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018; y 2155 SELECT * FROM tbl_year WHERE y >= 2018; y 2018 2155 SELECT * FROM tbl_year WHERE y = 2018; y 2018 SELECT * FROM tbl_year WHERE y <> 2018; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154; y 2155 SELECT * FROM tbl_year WHERE y >= 2154; y 2155 SELECT * FROM tbl_year WHERE y = 2154; y SELECT * FROM tbl_year WHERE y <> 2154; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2155; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155; y SELECT * FROM tbl_year WHERE y >= 2155; y 2155 SELECT * FROM tbl_year WHERE y = 2155; y 2155 SELECT * FROM tbl_year WHERE y <> 2155; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2156; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156; y SELECT * FROM tbl_year WHERE y >= 2156; y SELECT * FROM tbl_year WHERE y = 2156; y SELECT * FROM tbl_year WHERE y <> 2156; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # I N T abbreviated constant CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0; y SELECT * FROM tbl_year WHERE y <= 0; y 0000 SELECT * FROM tbl_year WHERE y > 0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0; y 0000 SELECT * FROM tbl_year WHERE y <> 0; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1; y SELECT * FROM tbl_year WHERE y <= -1; y SELECT * FROM tbl_year WHERE y > -1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1; y SELECT * FROM tbl_year WHERE y <> -1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1; y SELECT * FROM tbl_year WHERE y <> 1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300; y 0000 SELECT * FROM tbl_year WHERE y <= 300; y 0000 SELECT * FROM tbl_year WHERE y > 300; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300; y SELECT * FROM tbl_year WHERE y <> 300; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900; y 0000 SELECT * FROM tbl_year WHERE y <= 1900; y 0000 SELECT * FROM tbl_year WHERE y > 1900; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900; y SELECT * FROM tbl_year WHERE y <> 1900; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 01; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 01; y 0000 1901 SELECT * FROM tbl_year WHERE y > 01; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 01; y 2018 2155 SELECT * FROM tbl_year WHERE y = 01; y SELECT * FROM tbl_year WHERE y <> 01; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 01; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 02; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 02; y 0000 1901 SELECT * FROM tbl_year WHERE y > 02; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 02; y 2018 2155 SELECT * FROM tbl_year WHERE y = 02; y SELECT * FROM tbl_year WHERE y <> 02; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <= 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y > 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2002) EXPLAIN SELECT * FROM tbl_year WHERE y >= 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y = 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <> 02; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2002) SELECT * FROM tbl_year WHERE y < 18; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 18; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 18; y 2155 SELECT * FROM tbl_year WHERE y >= 18; y 2018 2155 SELECT * FROM tbl_year WHERE y = 18; y 2018 SELECT * FROM tbl_year WHERE y <> 18; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 18; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154; y 2155 SELECT * FROM tbl_year WHERE y >= 2154; y 2155 SELECT * FROM tbl_year WHERE y = 2154; y SELECT * FROM tbl_year WHERE y <> 2154; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2155; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155; y SELECT * FROM tbl_year WHERE y >= 2155; y 2155 SELECT * FROM tbl_year WHERE y = 2155; y 2155 SELECT * FROM tbl_year WHERE y <> 2155; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2156; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156; y SELECT * FROM tbl_year WHERE y >= 2156; y SELECT * FROM tbl_year WHERE y = 2156; y SELECT * FROM tbl_year WHERE y <> 2156; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # D E C I M A L constant with zero fraction CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0.0; y SELECT * FROM tbl_year WHERE y <= 0.0; y 0000 SELECT * FROM tbl_year WHERE y > 0.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0.0; y 0000 SELECT * FROM tbl_year WHERE y <> 0.0; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1.0; y SELECT * FROM tbl_year WHERE y <= -1.0; y SELECT * FROM tbl_year WHERE y > -1.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1.0; y SELECT * FROM tbl_year WHERE y <> -1.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1.0; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1.0; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1.0; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1.0; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1.0; y SELECT * FROM tbl_year WHERE y <> 1.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300.0; y 0000 SELECT * FROM tbl_year WHERE y <= 300.0; y 0000 SELECT * FROM tbl_year WHERE y > 300.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300.0; y SELECT * FROM tbl_year WHERE y <> 300.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900.0; y 0000 SELECT * FROM tbl_year WHERE y <= 1900.0; y 0000 SELECT * FROM tbl_year WHERE y > 1900.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900.0; y SELECT * FROM tbl_year WHERE y <> 1900.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1901.0; y 0000 SELECT * FROM tbl_year WHERE y <= 1901.0; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901.0; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901.0; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1901.0; y 1901 SELECT * FROM tbl_year WHERE y <> 1901.0; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1902.0; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902.0; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902.0; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902.0; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902.0; y SELECT * FROM tbl_year WHERE y <> 1902.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 2018.0; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 2018.0; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018.0; y 2155 SELECT * FROM tbl_year WHERE y >= 2018.0; y 2018 2155 SELECT * FROM tbl_year WHERE y = 2018.0; y 2018 SELECT * FROM tbl_year WHERE y <> 2018.0; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154.0; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154.0; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154.0; y 2155 SELECT * FROM tbl_year WHERE y >= 2154.0; y 2155 SELECT * FROM tbl_year WHERE y = 2154.0; y SELECT * FROM tbl_year WHERE y <> 2154.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155.0; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2155.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155.0; y SELECT * FROM tbl_year WHERE y >= 2155.0; y 2155 SELECT * FROM tbl_year WHERE y = 2155.0; y 2155 SELECT * FROM tbl_year WHERE y <> 2155.0; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2156.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156.0; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156.0; y SELECT * FROM tbl_year WHERE y >= 2156.0; y SELECT * FROM tbl_year WHERE y = 2156.0; y SELECT * FROM tbl_year WHERE y <> 2156.0; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156.0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # D E C I M A L constant with non-zero fraction CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0.1; y SELECT * FROM tbl_year WHERE y <= 0.1; y 0000 SELECT * FROM tbl_year WHERE y > 0.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0.1; y 0000 SELECT * FROM tbl_year WHERE y <> 0.1; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1.1; y SELECT * FROM tbl_year WHERE y <= -1.1; y SELECT * FROM tbl_year WHERE y > -1.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1.1; y SELECT * FROM tbl_year WHERE y <> -1.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1.1; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1.1; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1.1; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1.1; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1.1; y SELECT * FROM tbl_year WHERE y <> 1.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300.1; y 0000 SELECT * FROM tbl_year WHERE y <= 300.1; y 0000 SELECT * FROM tbl_year WHERE y > 300.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300.1; y SELECT * FROM tbl_year WHERE y <> 300.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900.1; y 0000 SELECT * FROM tbl_year WHERE y <= 1900.1; y 0000 SELECT * FROM tbl_year WHERE y > 1900.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900.1; y SELECT * FROM tbl_year WHERE y <> 1900.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1901.1; y 0000 SELECT * FROM tbl_year WHERE y <= 1901.1; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901.1; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901.1; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1901.1; y 1901 SELECT * FROM tbl_year WHERE y <> 1901.1; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1902.1; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902.1; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902.1; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902.1; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902.1; y SELECT * FROM tbl_year WHERE y <> 1902.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 2018.1; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 2018.1; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018.1; y 2155 SELECT * FROM tbl_year WHERE y >= 2018.1; y 2018 2155 SELECT * FROM tbl_year WHERE y = 2018.1; y 2018 SELECT * FROM tbl_year WHERE y <> 2018.1; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154.1; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154.1; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154.1; y 2155 SELECT * FROM tbl_year WHERE y >= 2154.1; y 2155 SELECT * FROM tbl_year WHERE y = 2154.1; y SELECT * FROM tbl_year WHERE y <> 2154.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155.1; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2155.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155.1; y SELECT * FROM tbl_year WHERE y >= 2155.1; y 2155 SELECT * FROM tbl_year WHERE y = 2155.1; y 2155 SELECT * FROM tbl_year WHERE y <> 2155.1; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2156.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156.1; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156.1; y SELECT * FROM tbl_year WHERE y >= 2156.1; y SELECT * FROM tbl_year WHERE y = 2156.1; y SELECT * FROM tbl_year WHERE y <> 2156.1; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156.1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0.9; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 0.9; y 0000 1901 SELECT * FROM tbl_year WHERE y > 0.9; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 0.9; y 2018 2155 SELECT * FROM tbl_year WHERE y = 0.9; y SELECT * FROM tbl_year WHERE y <> 0.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < -1.9; y SELECT * FROM tbl_year WHERE y <= -1.9; y SELECT * FROM tbl_year WHERE y > -1.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1.9; y SELECT * FROM tbl_year WHERE y <> -1.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1.9; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1.9; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1.9; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1.9; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1.9; y SELECT * FROM tbl_year WHERE y <> 1.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y > 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2002) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y = 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2002) SELECT * FROM tbl_year WHERE y < 300.9; y 0000 SELECT * FROM tbl_year WHERE y <= 300.9; y 0000 SELECT * FROM tbl_year WHERE y > 300.9; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300.9; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300.9; y SELECT * FROM tbl_year WHERE y <> 300.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900.9; y 0000 SELECT * FROM tbl_year WHERE y <= 1900.9; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1900.9; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900.9; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900.9; y 1901 SELECT * FROM tbl_year WHERE y <> 1900.9; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1901.9; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1901.9; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901.9; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901.9; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1901.9; y SELECT * FROM tbl_year WHERE y <> 1901.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 1902.9; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902.9; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902.9; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902.9; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902.9; y SELECT * FROM tbl_year WHERE y <> 1902.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1903) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1903) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1903) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1903) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1903) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1903) SELECT * FROM tbl_year WHERE y < 2018.9; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2018.9; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018.9; y 2155 SELECT * FROM tbl_year WHERE y >= 2018.9; y 2155 SELECT * FROM tbl_year WHERE y = 2018.9; y SELECT * FROM tbl_year WHERE y <> 2018.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2019) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2019) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2019) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2019) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2019) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2019) SELECT * FROM tbl_year WHERE y < 2154.9; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2154.9; y SELECT * FROM tbl_year WHERE y >= 2154.9; y 2155 SELECT * FROM tbl_year WHERE y = 2154.9; y 2155 SELECT * FROM tbl_year WHERE y <> 2154.9; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2155.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2155.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155.9; y SELECT * FROM tbl_year WHERE y >= 2155.9; y SELECT * FROM tbl_year WHERE y = 2155.9; y SELECT * FROM tbl_year WHERE y <> 2155.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 2156.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156.9; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156.9; y SELECT * FROM tbl_year WHERE y >= 2156.9; y SELECT * FROM tbl_year WHERE y = 2156.9; y SELECT * FROM tbl_year WHERE y <> 2156.9; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156.9; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # R E A L constant with zero fraction CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0.0E00; y SELECT * FROM tbl_year WHERE y <= 0.0E00; y 0000 SELECT * FROM tbl_year WHERE y > 0.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0.0E00; y 0000 SELECT * FROM tbl_year WHERE y <> 0.0E00; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1.0E00; y SELECT * FROM tbl_year WHERE y <= -1.0E00; y SELECT * FROM tbl_year WHERE y > -1.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1.0E00; y SELECT * FROM tbl_year WHERE y <> -1.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1.0E00; y SELECT * FROM tbl_year WHERE y <> 1.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300.0E00; y 0000 SELECT * FROM tbl_year WHERE y <= 300.0E00; y 0000 SELECT * FROM tbl_year WHERE y > 300.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300.0E00; y SELECT * FROM tbl_year WHERE y <> 300.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900.0E00; y 0000 SELECT * FROM tbl_year WHERE y <= 1900.0E00; y 0000 SELECT * FROM tbl_year WHERE y > 1900.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900.0E00; y SELECT * FROM tbl_year WHERE y <> 1900.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1901.0E00; y 0000 SELECT * FROM tbl_year WHERE y <= 1901.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901.0E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1901.0E00; y 1901 SELECT * FROM tbl_year WHERE y <> 1901.0E00; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1902.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902.0E00; y SELECT * FROM tbl_year WHERE y <> 1902.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 2018.0E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 2018.0E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018.0E00; y 2155 SELECT * FROM tbl_year WHERE y >= 2018.0E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 2018.0E00; y 2018 SELECT * FROM tbl_year WHERE y <> 2018.0E00; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154.0E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154.0E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154.0E00; y 2155 SELECT * FROM tbl_year WHERE y >= 2154.0E00; y 2155 SELECT * FROM tbl_year WHERE y = 2154.0E00; y SELECT * FROM tbl_year WHERE y <> 2154.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155.0E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2155.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155.0E00; y SELECT * FROM tbl_year WHERE y >= 2155.0E00; y 2155 SELECT * FROM tbl_year WHERE y = 2155.0E00; y 2155 SELECT * FROM tbl_year WHERE y <> 2155.0E00; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < 2156.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156.0E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156.0E00; y SELECT * FROM tbl_year WHERE y >= 2156.0E00; y SELECT * FROM tbl_year WHERE y = 2156.0E00; y SELECT * FROM tbl_year WHERE y <> 2156.0E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156.0E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # R E A L constant with non-zero fraction CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < 0.1E00; y SELECT * FROM tbl_year WHERE y <= 0.1E00; y 0000 SELECT * FROM tbl_year WHERE y > 0.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 0.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 0.1E00; y 0000 SELECT * FROM tbl_year WHERE y <> 0.1E00; y 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y > 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 0) EXPLAIN SELECT * FROM tbl_year WHERE y >= 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 0) EXPLAIN SELECT * FROM tbl_year WHERE y <> 0.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 0) SELECT * FROM tbl_year WHERE y < -1.1E00; y SELECT * FROM tbl_year WHERE y <= -1.1E00; y SELECT * FROM tbl_year WHERE y > -1.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= -1.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = -1.1E00; y SELECT * FROM tbl_year WHERE y <> -1.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> -1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1.1E00; y SELECT * FROM tbl_year WHERE y <> 1.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < 300.1E00; y 0000 SELECT * FROM tbl_year WHERE y <= 300.1E00; y 0000 SELECT * FROM tbl_year WHERE y > 300.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 300.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 300.1E00; y SELECT * FROM tbl_year WHERE y <> 300.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 300.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1900.1E00; y 0000 SELECT * FROM tbl_year WHERE y <= 1900.1E00; y 0000 SELECT * FROM tbl_year WHERE y > 1900.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= 1900.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1900.1E00; y SELECT * FROM tbl_year WHERE y <> 1900.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 1900.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 1901.1E00; y 0000 SELECT * FROM tbl_year WHERE y <= 1901.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1901.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1901.1E00; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = 1901.1E00; y 1901 SELECT * FROM tbl_year WHERE y <> 1901.1E00; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1901.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < 1902.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 1902.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y > 1902.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y >= 1902.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 1902.1E00; y SELECT * FROM tbl_year WHERE y <> 1902.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> 1902.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < 2018.1E00; y 0000 1901 SELECT * FROM tbl_year WHERE y <= 2018.1E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2018.1E00; y 2155 SELECT * FROM tbl_year WHERE y >= 2018.1E00; y 2018 2155 SELECT * FROM tbl_year WHERE y = 2018.1E00; y 2018 SELECT * FROM tbl_year WHERE y <> 2018.1E00; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2018.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < 2154.1E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= 2154.1E00; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > 2154.1E00; y 2155 SELECT * FROM tbl_year WHERE y >= 2154.1E00; y 2155 SELECT * FROM tbl_year WHERE y = 2154.1E00; y SELECT * FROM tbl_year WHERE y <> 2154.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> 2154.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < 2155.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2155.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2155.1E00; y SELECT * FROM tbl_year WHERE y >= 2155.1E00; y SELECT * FROM tbl_year WHERE y = 2155.1E00; y SELECT * FROM tbl_year WHERE y <> 2155.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2155.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < 2156.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= 2156.1E00; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > 2156.1E00; y SELECT * FROM tbl_year WHERE y >= 2156.1E00; y SELECT * FROM tbl_year WHERE y = 2156.1E00; y SELECT * FROM tbl_year WHERE y <> 2156.1E00; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> 2156.1E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # S T R I N G constant with I N T inside CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < '0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '0'; y SELECT * FROM tbl_year WHERE y <> '0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y > '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2000) EXPLAIN SELECT * FROM tbl_year WHERE y >= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y = '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2000) SELECT * FROM tbl_year WHERE y < '-1'; y SELECT * FROM tbl_year WHERE y <= '-1'; y SELECT * FROM tbl_year WHERE y > '-1'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '-1'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '-1'; y SELECT * FROM tbl_year WHERE y <> '-1'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1'; y SELECT * FROM tbl_year WHERE y <> '1'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < '300'; y 0000 SELECT * FROM tbl_year WHERE y <= '300'; y 0000 SELECT * FROM tbl_year WHERE y > '300'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '300'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '300'; y SELECT * FROM tbl_year WHERE y <> '300'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1900'; y 0000 SELECT * FROM tbl_year WHERE y <= '1900'; y 0000 SELECT * FROM tbl_year WHERE y > '1900'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '1900'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1900'; y SELECT * FROM tbl_year WHERE y <> '1900'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1901'; y 0000 SELECT * FROM tbl_year WHERE y <= '1901'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1901'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1901'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1901'; y 1901 SELECT * FROM tbl_year WHERE y <> '1901'; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1901'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < '1902'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1902'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1902'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1902'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1902'; y SELECT * FROM tbl_year WHERE y <> '1902'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1902'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < '2018'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '2018'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2018'; y 2155 SELECT * FROM tbl_year WHERE y >= '2018'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '2018'; y 2018 SELECT * FROM tbl_year WHERE y <> '2018'; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2018'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < '2154'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2154'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2154'; y 2155 SELECT * FROM tbl_year WHERE y >= '2154'; y 2155 SELECT * FROM tbl_year WHERE y = '2154'; y SELECT * FROM tbl_year WHERE y <> '2154'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < '2155'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2155'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2155'; y SELECT * FROM tbl_year WHERE y >= '2155'; y 2155 SELECT * FROM tbl_year WHERE y = '2155'; y 2155 SELECT * FROM tbl_year WHERE y <> '2155'; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < '2156'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= '2156'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2156'; y SELECT * FROM tbl_year WHERE y >= '2156'; y SELECT * FROM tbl_year WHERE y = '2156'; y SELECT * FROM tbl_year WHERE y <> '2156'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # S T R I N G constant with abbreviated I N T inside CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < '0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '0'; y SELECT * FROM tbl_year WHERE y <> '0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y > '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2000) EXPLAIN SELECT * FROM tbl_year WHERE y >= '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y = '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <> '0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2000) SELECT * FROM tbl_year WHERE y < '-1'; y SELECT * FROM tbl_year WHERE y <= '-1'; y SELECT * FROM tbl_year WHERE y > '-1'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '-1'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '-1'; y SELECT * FROM tbl_year WHERE y <> '-1'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '-1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1'; y SELECT * FROM tbl_year WHERE y <> '1'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < '300'; y 0000 SELECT * FROM tbl_year WHERE y <= '300'; y 0000 SELECT * FROM tbl_year WHERE y > '300'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '300'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '300'; y SELECT * FROM tbl_year WHERE y <> '300'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '300'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1900'; y 0000 SELECT * FROM tbl_year WHERE y <= '1900'; y 0000 SELECT * FROM tbl_year WHERE y > '1900'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '1900'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1900'; y SELECT * FROM tbl_year WHERE y <> '1900'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '1900'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '01'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '01'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '01'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '01'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '01'; y SELECT * FROM tbl_year WHERE y <> '01'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> '01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < '02'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '02'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '02'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '02'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '02'; y SELECT * FROM tbl_year WHERE y <> '02'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <= '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y > '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2002) EXPLAIN SELECT * FROM tbl_year WHERE y >= '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2002) EXPLAIN SELECT * FROM tbl_year WHERE y = '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2002) EXPLAIN SELECT * FROM tbl_year WHERE y <> '02'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2002) SELECT * FROM tbl_year WHERE y < '18'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '18'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '18'; y 2155 SELECT * FROM tbl_year WHERE y >= '18'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '18'; y 2018 SELECT * FROM tbl_year WHERE y <> '18'; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> '18'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < '2154'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2154'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2154'; y 2155 SELECT * FROM tbl_year WHERE y >= '2154'; y 2155 SELECT * FROM tbl_year WHERE y = '2154'; y SELECT * FROM tbl_year WHERE y <> '2154'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2154'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < '2155'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2155'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2155'; y SELECT * FROM tbl_year WHERE y >= '2155'; y 2155 SELECT * FROM tbl_year WHERE y = '2155'; y 2155 SELECT * FROM tbl_year WHERE y <> '2155'; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2155'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < '2156'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= '2156'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2156'; y SELECT * FROM tbl_year WHERE y >= '2156'; y SELECT * FROM tbl_year WHERE y = '2156'; y SELECT * FROM tbl_year WHERE y <> '2156'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '2156'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # S T R I N G constant with D E C I M A L inside CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < '0.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '0.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '0.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '0.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '0.0'; y SELECT * FROM tbl_year WHERE y <> '0.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y > '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2000) EXPLAIN SELECT * FROM tbl_year WHERE y >= '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y = '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <> '0.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2000) SELECT * FROM tbl_year WHERE y < '-1.0'; y SELECT * FROM tbl_year WHERE y <= '-1.0'; y SELECT * FROM tbl_year WHERE y > '-1.0'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '-1.0'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '-1.0'; y SELECT * FROM tbl_year WHERE y <> '-1.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '-1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1.0'; y SELECT * FROM tbl_year WHERE y <> '1.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < '300.0'; y 0000 SELECT * FROM tbl_year WHERE y <= '300.0'; y 0000 SELECT * FROM tbl_year WHERE y > '300.0'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '300.0'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '300.0'; y SELECT * FROM tbl_year WHERE y <> '300.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '300.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1900.0'; y 0000 SELECT * FROM tbl_year WHERE y <= '1900.0'; y 0000 SELECT * FROM tbl_year WHERE y > '1900.0'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '1900.0'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1900.0'; y SELECT * FROM tbl_year WHERE y <> '1900.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '1900.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1901.0'; y 0000 SELECT * FROM tbl_year WHERE y <= '1901.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1901.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1901.0'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1901.0'; y 1901 SELECT * FROM tbl_year WHERE y <> '1901.0'; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1901.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < '1902.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1902.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1902.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1902.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1902.0'; y SELECT * FROM tbl_year WHERE y <> '1902.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1902.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < '2018.0'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '2018.0'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2018.0'; y 2155 SELECT * FROM tbl_year WHERE y >= '2018.0'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '2018.0'; y 2018 SELECT * FROM tbl_year WHERE y <> '2018.0'; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2018.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < '2154.0'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2154.0'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2154.0'; y 2155 SELECT * FROM tbl_year WHERE y >= '2154.0'; y 2155 SELECT * FROM tbl_year WHERE y = '2154.0'; y SELECT * FROM tbl_year WHERE y <> '2154.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2154.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < '2155.0'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2155.0'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2155.0'; y SELECT * FROM tbl_year WHERE y >= '2155.0'; y 2155 SELECT * FROM tbl_year WHERE y = '2155.0'; y 2155 SELECT * FROM tbl_year WHERE y <> '2155.0'; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2155.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < '2156.0'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= '2156.0'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2156.0'; y SELECT * FROM tbl_year WHERE y >= '2156.0'; y SELECT * FROM tbl_year WHERE y = '2156.0'; y SELECT * FROM tbl_year WHERE y <> '2156.0'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '2156.0'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; # S T R I N G constant with R E A L inside CREATE TABLE tbl_year (y YEAR ); INSERT INTO tbl_year VALUES (0), (1901), (2018), (2155); ANALYZE TABLE tbl_year; Table Op Msg_type Msg_text test.tbl_year analyze status OK SELECT * FROM tbl_year; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y < '0.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '0.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '0.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '0.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '0.0E00'; y SELECT * FROM tbl_year WHERE y <> '0.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <= '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y > '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2000) EXPLAIN SELECT * FROM tbl_year WHERE y >= '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2000) EXPLAIN SELECT * FROM tbl_year WHERE y = '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2000) EXPLAIN SELECT * FROM tbl_year WHERE y <> '0.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2000) SELECT * FROM tbl_year WHERE y < '-1.0E00'; y SELECT * FROM tbl_year WHERE y <= '-1.0E00'; y SELECT * FROM tbl_year WHERE y > '-1.0E00'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '-1.0E00'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '-1.0E00'; y SELECT * FROM tbl_year WHERE y <> '-1.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <= '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y > '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y >= '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y = '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '-1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1.0E00'; y SELECT * FROM tbl_year WHERE y <> '1.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y > '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2001) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2001) EXPLAIN SELECT * FROM tbl_year WHERE y = '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2001) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2001) SELECT * FROM tbl_year WHERE y < '300.0E00'; y 0000 SELECT * FROM tbl_year WHERE y <= '300.0E00'; y 0000 SELECT * FROM tbl_year WHERE y > '300.0E00'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '300.0E00'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '300.0E00'; y SELECT * FROM tbl_year WHERE y <> '300.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 300) EXPLAIN SELECT * FROM tbl_year WHERE y <= '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 300) EXPLAIN SELECT * FROM tbl_year WHERE y > '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 300) EXPLAIN SELECT * FROM tbl_year WHERE y >= '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 300) EXPLAIN SELECT * FROM tbl_year WHERE y = '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '300.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1900.0E00'; y 0000 SELECT * FROM tbl_year WHERE y <= '1900.0E00'; y 0000 SELECT * FROM tbl_year WHERE y > '1900.0E00'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y >= '1900.0E00'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1900.0E00'; y SELECT * FROM tbl_year WHERE y <> '1900.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1900) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y > '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1900) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1900) EXPLAIN SELECT * FROM tbl_year WHERE y = '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '1900.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) SELECT * FROM tbl_year WHERE y < '1901.0E00'; y 0000 SELECT * FROM tbl_year WHERE y <= '1901.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1901.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1901.0E00'; y 1901 2018 2155 SELECT * FROM tbl_year WHERE y = '1901.0E00'; y 1901 SELECT * FROM tbl_year WHERE y <> '1901.0E00'; y 0000 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y > '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1901) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1901) EXPLAIN SELECT * FROM tbl_year WHERE y = '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1901) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1901.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1901) SELECT * FROM tbl_year WHERE y < '1902.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '1902.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y > '1902.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y >= '1902.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '1902.0E00'; y SELECT * FROM tbl_year WHERE y <> '1902.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <= '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y > '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 1902) EXPLAIN SELECT * FROM tbl_year WHERE y >= '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 1902) EXPLAIN SELECT * FROM tbl_year WHERE y = '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 1902) EXPLAIN SELECT * FROM tbl_year WHERE y <> '1902.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 1902) SELECT * FROM tbl_year WHERE y < '2018.0E00'; y 0000 1901 SELECT * FROM tbl_year WHERE y <= '2018.0E00'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2018.0E00'; y 2155 SELECT * FROM tbl_year WHERE y >= '2018.0E00'; y 2018 2155 SELECT * FROM tbl_year WHERE y = '2018.0E00'; y 2018 SELECT * FROM tbl_year WHERE y <> '2018.0E00'; y 0000 1901 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y > '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2018) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2018) EXPLAIN SELECT * FROM tbl_year WHERE y = '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2018) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2018.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2018) SELECT * FROM tbl_year WHERE y < '2154.0E00'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2154.0E00'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y > '2154.0E00'; y 2155 SELECT * FROM tbl_year WHERE y >= '2154.0E00'; y 2155 SELECT * FROM tbl_year WHERE y = '2154.0E00'; y SELECT * FROM tbl_year WHERE y <> '2154.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y > '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` > 2154) EXPLAIN SELECT * FROM tbl_year WHERE y >= '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` >= 2154) EXPLAIN SELECT * FROM tbl_year WHERE y = '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2154) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2154.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2154) SELECT * FROM tbl_year WHERE y < '2155.0E00'; y 0000 1901 2018 SELECT * FROM tbl_year WHERE y <= '2155.0E00'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2155.0E00'; y SELECT * FROM tbl_year WHERE y >= '2155.0E00'; y 2155 SELECT * FROM tbl_year WHERE y = '2155.0E00'; y 2155 SELECT * FROM tbl_year WHERE y <> '2155.0E00'; y 0000 1901 2018 EXPLAIN SELECT * FROM tbl_year WHERE y < '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` < 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y = '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 25.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` = 2155) EXPLAIN SELECT * FROM tbl_year WHERE y <> '2155.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` <> 2155) SELECT * FROM tbl_year WHERE y < '2156.0E00'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y <= '2156.0E00'; y 0000 1901 2018 2155 SELECT * FROM tbl_year WHERE y > '2156.0E00'; y SELECT * FROM tbl_year WHERE y >= '2156.0E00'; y SELECT * FROM tbl_year WHERE y = '2156.0E00'; y SELECT * FROM tbl_year WHERE y <> '2156.0E00'; y 0000 1901 2018 2155 EXPLAIN SELECT * FROM tbl_year WHERE y < '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y <= '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) EXPLAIN SELECT * FROM tbl_year WHERE y > '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y >= '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y = '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where false EXPLAIN SELECT * FROM tbl_year WHERE y <> '2156.0E00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_year NULL ALL NULL NULL NULL NULL 4 75.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_year`.`y` AS `y` from `test`.`tbl_year` where (`test`.`tbl_year`.`y` is not null) DROP TABLE tbl_year; CREATE TABLE tbl_ts (t TIMESTAMP ); INSERT INTO tbl_ts VALUES ('1970-01-01 03:00:01'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07'); ANALYZE TABLE tbl_ts; Table Op Msg_type Msg_text test.tbl_ts analyze status OK SELECT * FROM tbl_ts; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Zero date? SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Some in range constants SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_ts WHERE t < 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t <= 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t > 20380119061407; t SELECT * FROM tbl_ts WHERE t >= 20380119061407; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 20380119061407; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t <> 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018) SELECT * FROM tbl_ts WHERE t < 0; t SELECT * FROM tbl_ts WHERE t <= 0; t SELECT * FROM tbl_ts WHERE t > 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 0; t SELECT * FROM tbl_ts WHERE t <> 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t > 20380119061405.55; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 20380119061405.55; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:06') SELECT * FROM tbl_ts WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018.55) SELECT * FROM tbl_ts WHERE t < 0.00; t SELECT * FROM tbl_ts WHERE t <= 0.00; t SELECT * FROM tbl_ts WHERE t > 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 0.00; t SELECT * FROM tbl_ts WHERE t <> 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:06') SELECT * FROM tbl_ts WHERE t < 0.00E00; t SELECT * FROM tbl_ts WHERE t <= 0.00E00; t SELECT * FROM tbl_ts WHERE t > 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t >= 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_ts WHERE t = 0.00E00; t SELECT * FROM tbl_ts WHERE t <> 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_ts; CREATE TABLE tbl_ts (t TIMESTAMP(2) ); INSERT INTO tbl_ts VALUES ('1970-01-01 03:00:01.00'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07.99'); ANALYZE TABLE tbl_ts; Table Op Msg_type Msg_text test.tbl_ts analyze status OK SELECT * FROM tbl_ts; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Zero date? SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Some in range constants SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_ts WHERE t < 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t <= 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t > 20380119061407; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 20380119061407; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 20380119061407; t SELECT * FROM tbl_ts WHERE t <> 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018) SELECT * FROM tbl_ts WHERE t < 0; t SELECT * FROM tbl_ts WHERE t <= 0; t SELECT * FROM tbl_ts WHERE t > 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 0; t SELECT * FROM tbl_ts WHERE t <> 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t > 20380119061405.55; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 20380119061405.55; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_ts WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018.55) SELECT * FROM tbl_ts WHERE t < 0.00; t SELECT * FROM tbl_ts WHERE t <= 0.00; t SELECT * FROM tbl_ts WHERE t > 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 0.00; t SELECT * FROM tbl_ts WHERE t <> 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_ts WHERE t < 0.00E00; t SELECT * FROM tbl_ts WHERE t <= 0.00E00; t SELECT * FROM tbl_ts WHERE t > 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t >= 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_ts WHERE t = 0.00E00; t SELECT * FROM tbl_ts WHERE t <> 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_ts; CREATE TABLE tbl_ts (t TIMESTAMP(6) ); INSERT INTO tbl_ts VALUES ('1970-01-01 03:00:01.000000'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07.999999'); ANALYZE TABLE tbl_ts; Table Op Msg_type Msg_text test.tbl_ts analyze status OK SELECT * FROM tbl_ts; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Zero date? SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where false EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` is not null) Some in range constants SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_ts WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_ts WHERE t < 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t > 20380119061407; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 20380119061407; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 20380119061407; t SELECT * FROM tbl_ts WHERE t <> 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_ts WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018) SELECT * FROM tbl_ts WHERE t < 0; t SELECT * FROM tbl_ts WHERE t <= 0; t SELECT * FROM tbl_ts WHERE t > 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 0; t SELECT * FROM tbl_ts WHERE t <> 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t > 20380119061405.55; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 20380119061405.55; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_ts WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t > 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t >= 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_ts WHERE t <> 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_ts WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_ts WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> 2018.55) SELECT * FROM tbl_ts WHERE t < 0.00; t SELECT * FROM tbl_ts WHERE t <= 0.00; t SELECT * FROM tbl_ts WHERE t > 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 0.00; t SELECT * FROM tbl_ts WHERE t <> 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_ts WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_ts WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'2038-01-19 06:14:05.550781') SELECT * FROM tbl_ts WHERE t < 0.00E00; t SELECT * FROM tbl_ts WHERE t <= 0.00E00; t SELECT * FROM tbl_ts WHERE t > 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t >= 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_ts WHERE t = 0.00E00; t SELECT * FROM tbl_ts WHERE t <> 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_ts WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_ts WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_ts NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_ts`.`t` AS `t` from `test`.`tbl_ts` where (`test`.`tbl_ts`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_ts; CREATE TABLE tbl_datetime (t DATETIME ); INSERT INTO tbl_datetime VALUES ('1970-01-01 03:00:01'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07'); ANALYZE TABLE tbl_datetime; Table Op Msg_type Msg_text test.tbl_datetime analyze status OK SELECT * FROM tbl_datetime; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Zero date? SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08.000000') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Some in range constants SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01 SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_datetime WHERE t < 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t <= 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t > 20380119061407; t SELECT * FROM tbl_datetime WHERE t >= 20380119061407; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 20380119061407; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t <> 20380119061407; t 1970-01-01 03:00:01 2018-06-19 21:00:00 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018) SELECT * FROM tbl_datetime WHERE t < 0; t SELECT * FROM tbl_datetime WHERE t <= 0; t SELECT * FROM tbl_datetime WHERE t > 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 0; t SELECT * FROM tbl_datetime WHERE t <> 0; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:06') SELECT * FROM tbl_datetime WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018.55; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018.55) SELECT * FROM tbl_datetime WHERE t < 0.00; t SELECT * FROM tbl_datetime WHERE t <= 0.00; t SELECT * FROM tbl_datetime WHERE t > 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 0.00; t SELECT * FROM tbl_datetime WHERE t <> 0.00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:06') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:06') SELECT * FROM tbl_datetime WHERE t < 0.00E00; t SELECT * FROM tbl_datetime WHERE t <= 0.00E00; t SELECT * FROM tbl_datetime WHERE t > 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t >= 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 SELECT * FROM tbl_datetime WHERE t = 0.00E00; t SELECT * FROM tbl_datetime WHERE t <> 0.00E00; t 1970-01-01 03:00:01 2018-06-19 21:00:00 2038-01-19 06:14:07 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_datetime; CREATE TABLE tbl_datetime (t DATETIME(2) ); INSERT INTO tbl_datetime VALUES ('1970-01-01 03:00:01.00'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07.99'); ANALYZE TABLE tbl_datetime; Table Op Msg_type Msg_text test.tbl_datetime analyze status OK SELECT * FROM tbl_datetime; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Zero date? SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08.000000') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Some in range constants SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.00 SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_datetime WHERE t < 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t <= 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t > 20380119061407; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 20380119061407; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 20380119061407; t SELECT * FROM tbl_datetime WHERE t <> 20380119061407; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018) SELECT * FROM tbl_datetime WHERE t < 0; t SELECT * FROM tbl_datetime WHERE t <= 0; t SELECT * FROM tbl_datetime WHERE t > 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 0; t SELECT * FROM tbl_datetime WHERE t <> 0; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_datetime WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018.55; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018.55) SELECT * FROM tbl_datetime WHERE t < 0.00; t SELECT * FROM tbl_datetime WHERE t <= 0.00; t SELECT * FROM tbl_datetime WHERE t > 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 0.00; t SELECT * FROM tbl_datetime WHERE t <> 0.00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_datetime WHERE t < 0.00E00; t SELECT * FROM tbl_datetime WHERE t <= 0.00E00; t SELECT * FROM tbl_datetime WHERE t > 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t >= 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 SELECT * FROM tbl_datetime WHERE t = 0.00E00; t SELECT * FROM tbl_datetime WHERE t <> 0.00E00; t 1970-01-01 03:00:01.00 2018-06-19 21:00:00.00 2038-01-19 06:14:07.99 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_datetime; CREATE TABLE tbl_datetime (t DATETIME(6) ); INSERT INTO tbl_datetime VALUES ('1970-01-01 03:00:01.000000'), ('2018-06-19 21:00:00'), ('2038-01-19 06:14:07.999999'); ANALYZE TABLE tbl_datetime; Table Op Msg_type Msg_text test.tbl_datetime analyze status OK SELECT * FROM tbl_datetime; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals TIMESTAMP: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME: 1970, 2038 just fine. SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 10:20:30') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 10:20:30'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 10:20:30') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Zero date? SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '0000-00-00 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') Zero in date SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; t SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2018-00-03 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2018-00-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2018-00-03 00:00:00') Some in range string literals SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> '1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 2. TIMESTAMP literals These are the same as above, but with TIMESTAMP prefix. TIMESTAMP field: Some out of range constants (adjusted to TZ +0300 for MTR) DATETIME field: in range SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07.999999') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:08.000000') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:08.000000'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:08.000000') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 00:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 00:00:01') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:00.999999') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:00.999999'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:00.999999') Some in range constants SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; t SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'2038-01-19 06:14:07'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; t SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; t 1970-01-01 03:00:01.000000 SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; t 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t > TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t = TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'1970-01-01 03:00:01') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> TIMESTAMP'1970-01-01 03:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'1970-01-01 03:00:01') 3. Integer literals SELECT * FROM tbl_datetime WHERE t < 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t > 20380119061407; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 20380119061407; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 20380119061407; t SELECT * FROM tbl_datetime WHERE t <> 20380119061407; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:07') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061407; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:07') SELECT * FROM tbl_datetime WHERE t < 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018; t Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018) SELECT * FROM tbl_datetime WHERE t < 0; t SELECT * FROM tbl_datetime WHERE t <= 0; t SELECT * FROM tbl_datetime WHERE t > 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 0; t SELECT * FROM tbl_datetime WHERE t <> 0; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Decimal literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:05.55') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:05.55') SELECT * FROM tbl_datetime WHERE t < 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <= 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t > 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t >= 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t = 2018.55; t Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 SELECT * FROM tbl_datetime WHERE t <> 2018.55; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = 2018.55) EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect datetime value: '2018.55' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> 2018.55) SELECT * FROM tbl_datetime WHERE t < 0.00; t SELECT * FROM tbl_datetime WHERE t <= 0.00; t SELECT * FROM tbl_datetime WHERE t > 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 0.00; t SELECT * FROM tbl_datetime WHERE t <> 0.00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') 3. Real literals: rounded up to whole seconds SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; t 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; t SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'2038-01-19 06:14:05.550781') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 20380119061405.55E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'2038-01-19 06:14:05.550781') SELECT * FROM tbl_datetime WHERE t < 0.00E00; t SELECT * FROM tbl_datetime WHERE t <= 0.00E00; t SELECT * FROM tbl_datetime WHERE t > 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t >= 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 SELECT * FROM tbl_datetime WHERE t = 0.00E00; t SELECT * FROM tbl_datetime WHERE t <> 0.00E00; t 1970-01-01 03:00:01.000000 2018-06-19 21:00:00.000000 2038-01-19 06:14:07.999999 EXPLAIN SELECT * FROM tbl_datetime WHERE t < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` < TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` > TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` >= TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` = TIMESTAMP'0000-00-00 00:00:00') EXPLAIN SELECT * FROM tbl_datetime WHERE t <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_datetime NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_datetime`.`t` AS `t` from `test`.`tbl_datetime` where (`test`.`tbl_datetime`.`t` <> TIMESTAMP'0000-00-00 00:00:00') DROP TABLE tbl_datetime; CREATE TABLE tbl_date(d DATE); INSERT INTO tbl_date VALUES ('0000-01-01'), ('2038-01-19'), ('9999-12-31'); ANALYZE TABLE tbl_date; Table Op Msg_type Msg_text test.tbl_date analyze status OK SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=ALLOW_INVALID_DATES; 1. String literals Semi supported SELECT * FROM tbl_date WHERE d < '0000-01-01'; d SELECT * FROM tbl_date WHERE d <= '0000-01-01'; d 0000-01-01 SELECT * FROM tbl_date WHERE d > '0000-01-01'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= '0000-01-01'; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '0000-01-01'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <> '0000-01-01'; d 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'0000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d <= '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'0000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d > '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'0000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d >= '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'0000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d = '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'0000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d <> '0000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'0000-01-01') SELECT * FROM tbl_date WHERE d < '2038-01-19'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= '2038-01-19'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > '2038-01-19'; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= '2038-01-19'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '2038-01-19'; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> '2038-01-19'; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> '2038-01-19'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') SELECT * FROM tbl_date WHERE d < '1000-01-01'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= '1000-01-01'; d 0000-01-01 SELECT * FROM tbl_date WHERE d > '1000-01-01'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= '1000-01-01'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '1000-01-01'; d SELECT * FROM tbl_date WHERE d <> '1000-01-01'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'1000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d <= '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'1000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d > '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'1000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d >= '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'1000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d = '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'1000-01-01') EXPLAIN SELECT * FROM tbl_date WHERE d <> '1000-01-01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'1000-01-01') SELECT * FROM tbl_date WHERE d < '9999-12-31'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d <= '9999-12-31'; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d > '9999-12-31'; d SELECT * FROM tbl_date WHERE d >= '9999-12-31'; d 9999-12-31 SELECT * FROM tbl_date WHERE d = '9999-12-31'; d 9999-12-31 SELECT * FROM tbl_date WHERE d <> '9999-12-31'; d 0000-01-01 2038-01-19 EXPLAIN SELECT * FROM tbl_date WHERE d < '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'9999-12-31') EXPLAIN SELECT * FROM tbl_date WHERE d <= '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'9999-12-31') EXPLAIN SELECT * FROM tbl_date WHERE d > '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'9999-12-31') EXPLAIN SELECT * FROM tbl_date WHERE d >= '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'9999-12-31') EXPLAIN SELECT * FROM tbl_date WHERE d = '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'9999-12-31') EXPLAIN SELECT * FROM tbl_date WHERE d <> '9999-12-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'9999-12-31') Compare to a full datetime value instead of a date SELECT * FROM tbl_date WHERE d < '2038-01-19 12:45:00'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d <= '2038-01-19 12:45:00'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > '2038-01-19 12:45:00'; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= '2038-01-19 12:45:00'; d 9999-12-31 SELECT * FROM tbl_date WHERE d = '2038-01-19 12:45:00'; d SELECT * FROM tbl_date WHERE d <> '2038-01-19 12:45:00'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where false EXPLAIN SELECT * FROM tbl_date WHERE d <> '2038-01-19 12:45:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` is not null) Zero date? SELECT * FROM tbl_date WHERE d < '0000-00-00'; d SELECT * FROM tbl_date WHERE d <= '0000-00-00'; d SELECT * FROM tbl_date WHERE d > '0000-00-00'; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= '0000-00-00'; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '0000-00-00'; d SELECT * FROM tbl_date WHERE d <> '0000-00-00'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <= '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d > '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d >= '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d = '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <> '0000-00-00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'0000-00-00') Zero in date SELECT * FROM tbl_date WHERE d < '2018-00-03'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= '2018-00-03'; d 0000-01-01 SELECT * FROM tbl_date WHERE d > '2018-00-03'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= '2018-00-03'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '2018-00-03'; d SELECT * FROM tbl_date WHERE d <> '2018-00-03'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2018-00-03') EXPLAIN SELECT * FROM tbl_date WHERE d <= '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2018-00-03') EXPLAIN SELECT * FROM tbl_date WHERE d > '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2018-00-03') EXPLAIN SELECT * FROM tbl_date WHERE d >= '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2018-00-03') EXPLAIN SELECT * FROM tbl_date WHERE d = '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2018-00-03') EXPLAIN SELECT * FROM tbl_date WHERE d <> '2018-00-03'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2018-00-03') Strangely, this does not give an error nor warning, and does comparison using internal datetime comparison (pre-folding), so we do the same. SELECT * FROM tbl_date WHERE d < '2018-02-31'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= '2018-02-31'; d 0000-01-01 SELECT * FROM tbl_date WHERE d > '2018-02-31'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= '2018-02-31'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = '2018-02-31'; d SELECT * FROM tbl_date WHERE d <> '2018-02-31'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2018-02-31') EXPLAIN SELECT * FROM tbl_date WHERE d <= '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2018-02-31') EXPLAIN SELECT * FROM tbl_date WHERE d > '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2018-02-31') EXPLAIN SELECT * FROM tbl_date WHERE d >= '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2018-02-31') EXPLAIN SELECT * FROM tbl_date WHERE d = '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2018-02-31') EXPLAIN SELECT * FROM tbl_date WHERE d <> '2018-02-31'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2018-02-31') 2. TIMESTAMP literals compared with DATE field SELECT * FROM tbl_date WHERE d < TIMESTAMP'2038-01-19 00:00:00'; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= TIMESTAMP'2038-01-19 00:00:00'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > TIMESTAMP'2038-01-19 00:00:00'; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= TIMESTAMP'2038-01-19 00:00:00'; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = TIMESTAMP'2038-01-19 00:00:00'; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> TIMESTAMP'2038-01-19 00:00:00'; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < TIMESTAMP'2038-01-19 00:00:00') EXPLAIN SELECT * FROM tbl_date WHERE d <= TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= TIMESTAMP'2038-01-19 00:00:00') EXPLAIN SELECT * FROM tbl_date WHERE d > TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > TIMESTAMP'2038-01-19 00:00:00') EXPLAIN SELECT * FROM tbl_date WHERE d >= TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= TIMESTAMP'2038-01-19 00:00:00') EXPLAIN SELECT * FROM tbl_date WHERE d = TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = TIMESTAMP'2038-01-19 00:00:00') EXPLAIN SELECT * FROM tbl_date WHERE d <> TIMESTAMP'2038-01-19 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> TIMESTAMP'2038-01-19 00:00:00') SELECT * FROM tbl_date WHERE d < TIMESTAMP'2038-01-19 00:00:01'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d <= TIMESTAMP'2038-01-19 00:00:01'; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > TIMESTAMP'2038-01-19 00:00:01'; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= TIMESTAMP'2038-01-19 00:00:01'; d 9999-12-31 SELECT * FROM tbl_date WHERE d = TIMESTAMP'2038-01-19 00:00:01'; d SELECT * FROM tbl_date WHERE d <> TIMESTAMP'2038-01-19 00:00:01'; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < TIMESTAMP'2038-01-19 00:00:01') EXPLAIN SELECT * FROM tbl_date WHERE d <= TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= TIMESTAMP'2038-01-19 00:00:01') EXPLAIN SELECT * FROM tbl_date WHERE d > TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > TIMESTAMP'2038-01-19 00:00:01') EXPLAIN SELECT * FROM tbl_date WHERE d >= TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= TIMESTAMP'2038-01-19 00:00:01') EXPLAIN SELECT * FROM tbl_date WHERE d = TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = TIMESTAMP'2038-01-19 00:00:01') EXPLAIN SELECT * FROM tbl_date WHERE d <> TIMESTAMP'2038-01-19 00:00:01'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> TIMESTAMP'2038-01-19 00:00:01') 3. Integer literals in range SELECT * FROM tbl_date WHERE d < 20380119; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') incorrect value; removes time part SELECT * FROM tbl_date WHERE d < 20380119124500; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119124500; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119124500; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119124500; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119124500; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119124500; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119124500; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') out of range; interpreted as a value smaller than TIMESTAMP min SELECT * FROM tbl_date WHERE d < 2018; d 0000-01-01 Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d <= 2018; d 0000-01-01 Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d > 2018; d 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d >= 2018; d 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d = 2018; d Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d <> 2018; d 0000-01-01 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 EXPLAIN SELECT * FROM tbl_date WHERE d < 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < 2018) EXPLAIN SELECT * FROM tbl_date WHERE d <= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= 2018) EXPLAIN SELECT * FROM tbl_date WHERE d > 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > 2018) EXPLAIN SELECT * FROM tbl_date WHERE d >= 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= 2018) EXPLAIN SELECT * FROM tbl_date WHERE d = 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = 2018) EXPLAIN SELECT * FROM tbl_date WHERE d <> 2018; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect date value: '2018' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> 2018) SELECT * FROM tbl_date WHERE d < 0; d SELECT * FROM tbl_date WHERE d <= 0; d SELECT * FROM tbl_date WHERE d > 0; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= 0; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 0; d SELECT * FROM tbl_date WHERE d <> 0; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d > 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d >= 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d = 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <> 0; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'0000-00-00') 3. Decimal literals SELECT * FROM tbl_date WHERE d < 20380119.00; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119.00; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119.00; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119.00; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119.00; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119.00; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') incorrect value; removes time part SELECT * FROM tbl_date WHERE d < 20380119061405.00; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119061405.00; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119061405.00; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119061405.00; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119061405.00; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119061405.00; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119061405.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') out of range - compare using double SELECT * FROM tbl_date WHERE d < 2018.55; d 0000-01-01 Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d <= 2018.55; d 0000-01-01 Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d > 2018.55; d 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d >= 2018.55; d 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d = 2018.55; d Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 SELECT * FROM tbl_date WHERE d <> 2018.55; d 0000-01-01 2038-01-19 9999-12-31 Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 EXPLAIN SELECT * FROM tbl_date WHERE d < 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < 2018.55) EXPLAIN SELECT * FROM tbl_date WHERE d <= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= 2018.55) EXPLAIN SELECT * FROM tbl_date WHERE d > 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > 2018.55) EXPLAIN SELECT * FROM tbl_date WHERE d >= 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= 2018.55) EXPLAIN SELECT * FROM tbl_date WHERE d = 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = 2018.55) EXPLAIN SELECT * FROM tbl_date WHERE d <> 2018.55; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Warning 1292 Incorrect date value: '2018.55' for column 'd' at row 1 Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> 2018.55) SELECT * FROM tbl_date WHERE d < 0.00; d SELECT * FROM tbl_date WHERE d <= 0.00; d SELECT * FROM tbl_date WHERE d > 0.00; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= 0.00; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 0.00; d SELECT * FROM tbl_date WHERE d <> 0.00; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d > 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d >= 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d = 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <> 0.00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'0000-00-00') 3. Real literals: rounded up to whole seconds in range SELECT * FROM tbl_date WHERE d < 20380119E00; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119E00; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119E00; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119E00; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119E00; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119E00; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') incorrect value; removes time part SELECT * FROM tbl_date WHERE d < 20380119194500E00; d 0000-01-01 SELECT * FROM tbl_date WHERE d <= 20380119194500E00; d 0000-01-01 2038-01-19 SELECT * FROM tbl_date WHERE d > 20380119194500E00; d 9999-12-31 SELECT * FROM tbl_date WHERE d >= 20380119194500E00; d 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 20380119194500E00; d 2038-01-19 SELECT * FROM tbl_date WHERE d <> 20380119194500E00; d 0000-01-01 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <= 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d > 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d >= 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d = 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'2038-01-19') EXPLAIN SELECT * FROM tbl_date WHERE d <> 20380119194500E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'2038-01-19') out of range compare using double SELECT * FROM tbl_date WHERE d < 0.00E00; d SELECT * FROM tbl_date WHERE d <= 0.00E00; d SELECT * FROM tbl_date WHERE d > 0.00E00; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d >= 0.00E00; d 0000-01-01 2038-01-19 9999-12-31 SELECT * FROM tbl_date WHERE d = 0.00E00; d SELECT * FROM tbl_date WHERE d <> 0.00E00; d 0000-01-01 2038-01-19 9999-12-31 EXPLAIN SELECT * FROM tbl_date WHERE d < 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` < DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d > 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` > DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d >= 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` >= DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d = 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 33.33 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` = DATE'0000-00-00') EXPLAIN SELECT * FROM tbl_date WHERE d <> 0.00E00; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tbl_date NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 /* select#1 */ select `test`.`tbl_date`.`d` AS `d` from `test`.`tbl_date` where (`test`.`tbl_date`.`d` <> DATE'0000-00-00') DROP TABLE tbl_date; SET SESSION sql_mode = DEFAULT; CREATE TABLE t(t TIME); INSERT INTO t VALUES ('18:00:00'); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK SELECT * FROM t WHERE t = '18:00:00'; t 18:00:00 SELECT * FROM t WHERE t = '18:00:00.001'; t 18:00:00 SELECT * FROM t WHERE t = 180000; t 18:00:00 SELECT * FROM t WHERE t = 180000.001; t 18:00:00 SELECT * FROM t WHERE t = 'abra cadabra'; t Warnings: Warning 1292 Incorrect time value: 'abra cadabra' for column 't' at row 1 Note: for explicit TIME literal, the fraction part is not truncated This is existing behavior, not changed for WL#11935. SELECT * FROM t WHERE t = TIME'180000.001'; t EXPLAIN SELECT * FROM t WHERE t = '18:00:00'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = TIME'18:00:00') EXPLAIN SELECT * FROM t WHERE t = '18:00:00.001'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = TIME'18:00:00') EXPLAIN SELECT * FROM t WHERE t = 180000; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = TIME'18:00:00') EXPLAIN SELECT * FROM t WHERE t = 180000.001; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = TIME'18:00:00') EXPLAIN SELECT * FROM t WHERE t = TIME'180000.001'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = TIME'18:00:00.001') EXPLAIN SELECT * FROM t WHERE t = 'abra cadabra'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Warning 1292 Incorrect time value: 'abra cadabra' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = 'abra cadabra') EXPLAIN SELECT * FROM t WHERE t = 3.14E44; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Warning 1292 Incorrect time value: '3.14e44' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = 3.14E44) EXPLAIN SELECT * FROM t WHERE t = 30000000000000000.3567; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Warning 1292 Incorrect time value: '30000000000000000.3567' for column 't' at row 1 Note 1003 /* select#1 */ select `test`.`t`.`t` AS `t` from `test`.`t` where (`test`.`t`.`t` = 30000000000000000.3567) DROP TABLE t; CREATE TABLE t(i TINYINT NOT NULL, j TINYINT NOT NULL); INSERT INTO t VALUES (1,1), (1,2), (2,1), (2,2); ANALYZE TABLE t; Table Op Msg_type Msg_text test.t analyze status OK Should fold to TRUE SELECT SUM(i) s, j FROM t WHERE j != 128 GROUP BY j; s j 3 1 3 2 EXPLAIN SELECT SUM(i) s, j FROM t WHERE j != 128 GROUP BY j; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select sum(`test`.`t`.`i`) AS `s`,`test`.`t`.`j` AS `j` from `test`.`t` where true group by `test`.`t`.`j` SELECT SUM(i) s, j FROM t WHERE j != 128 GROUP BY j WITH ROLLUP; s j 3 1 3 2 6 NULL EXPLAIN SELECT SUM(i) s, j FROM t WHERE j != 128 GROUP BY j WITH ROLLUP; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select rollup_sum_switcher(sum(`test`.`t`.`i`)) AS `s`,rollup_group_item(`test`.`t`.`j`,0) AS `j` from `test`.`t` where true group by `test`.`t`.`j` with rollup SELECT SUM(i) s, j FROM t GROUP BY j HAVING j != 128; s j 3 1 3 2 EXPLAIN SELECT SUM(i) s, j FROM t GROUP BY j HAVING j != 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select sum(`test`.`t`.`i`) AS `s`,`test`.`t`.`j` AS `j` from `test`.`t` group by `test`.`t`.`j` having true Should fold to IS NOT NULL SELECT SUM(i) s, j FROM t GROUP BY j WITH ROLLUP HAVING j != 128; s j 3 1 3 2 EXPLAIN SELECT SUM(i) s, j FROM t GROUP BY j WITH ROLLUP HAVING j != 128; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select rollup_sum_switcher(sum(`test`.`t`.`i`)) AS `s`,rollup_group_item(`test`.`t`.`j`,0) AS `j` from `test`.`t` group by `test`.`t`.`j` with rollup having (rollup_group_item(rollup_group_item(`test`.`t`.`j`,0),0) <> 128) SELECT SUM(i) s, j FROM t GROUP BY j WITH ROLLUP HAVING j IS NOT NULL; s j 3 1 3 2 EXPLAIN SELECT SUM(i) s, j FROM t GROUP BY j WITH ROLLUP HAVING j IS NOT NULL; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select rollup_sum_switcher(sum(`test`.`t`.`i`)) AS `s`,rollup_group_item(`test`.`t`.`j`,0) AS `j` from `test`.`t` group by `test`.`t`.`j` with rollup having (rollup_group_item(rollup_group_item(`test`.`t`.`j`,0),0) is not null) DROP TABLE t; CREATE TABLE a(col_int INT, col_date DATE); SELECT col_date FROM a WHERE (NULL, NULL) IN (SELECT col_date, col_date FROM a) OR (col_int <> 'C') ; col_date Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'C' DROP TABLE a; CREATE TABLE t11 (col_time TIME); INSERT INTO t11 VALUES('11:00:00'); An integer value that could not be converted into a TIME literal should default to old behavior (comparing as double). EXPLAIN SELECT col_time FROM t11 HAVING col_time > 156970; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 1 100.00 NULL Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 Note 1003 /* select#1 */ select `test`.`t11`.`col_time` AS `col_time` from `test`.`t11` having (`test`.`t11`.`col_time` > 156970) SELECT col_time FROM t11 HAVING col_time > 156970; col_time Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 EXPLAIN SELECT col_time FROM t11 WHERE col_time > 156970; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 Note 1003 /* select#1 */ select `test`.`t11`.`col_time` AS `col_time` from `test`.`t11` where (`test`.`t11`.`col_time` > 156970) SELECT col_time FROM t11 WHERE col_time > 156970; col_time Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 EXPLAIN SELECT col_time FROM t11 WHERE col_time < 156970; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 Note 1003 /* select#1 */ select `test`.`t11`.`col_time` AS `col_time` from `test`.`t11` where (`test`.`t11`.`col_time` < 156970) SELECT col_time FROM t11 WHERE col_time < 156970; col_time 11:00:00 Warnings: Warning 1292 Incorrect time value: '156970' for column 'col_time' at row 1 DROP TABLE t11; CREATE TABLE t1(d DOUBLE); INSERT INTO t1 VALUES (3.3); CREATE TABLE t2 (ts TIMESTAMP); INSERT INTO t2 VALUES ('2018-09-15 11:00:25.00'); WITH RECURSIVE cte1 AS ( SELECT ts AS a1 FROM t2 ), cte2 AS ( SELECT LAST_DAY(18446744073709551615+1) AS a2 FROM t1 ) SELECT * FROM cte1, cte2 WHERE cte1.a1 <> cte2.a2; ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' DROP TABLE t1, t2; CREATE TABLE t(c DECIMAL(9,3)); SELECT * FROM t WHERE c <=> 8106.000000; c EXPLAIN SELECT * from t WHERE c <=> 8106.000000; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t`.`c` AS `c` from `test`.`t` where (`test`.`t`.`c` <=> 8106.000) DROP TABLE t; CREATE TABLE t0(c0 TINYINT); INSERT INTO t0(c0) VALUES(NULL); SELECT * FROM t0 WHERE NOT(t0.c0 <=> 2035382037); c0 NULL SELECT * FROM t0 WHERE t0.c0 <=> 2035382037; c0 DROP TABLE t0; CREATE TABLE t0(c0 INT); INSERT INTO t0(c0) VALUES (0); SELECT * FROM t0 WHERE 0.9 > t0.c0; c0 0 DROP TABLE t0;
Save File
Cancel