diff --git a/mysql-test/include/boolean_factor.inc b/mysql-test/include/boolean_factor.inc new file mode 100644 index 00000000000..e5e8a2fb58e --- /dev/null +++ b/mysql-test/include/boolean_factor.inc @@ -0,0 +1,39 @@ +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a; +SELECT id, a FROM t1 WHERE a; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a; +SELECT id, a FROM t1 WHERE NOT a; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS TRUE; +SELECT id, a FROM t1 WHERE a IS TRUE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +SELECT id, a FROM t1 WHERE NOT a IS TRUE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +SELECT id, a FROM t1 WHERE a IS NOT TRUE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS FALSE; +SELECT id, a FROM t1 WHERE a IS FALSE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +SELECT id, a FROM t1 WHERE NOT a IS FALSE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +SELECT id, a FROM t1 WHERE a IS NOT FALSE; + +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; diff --git a/mysql-test/main/bool.result b/mysql-test/main/bool.result index 184046a2d6f..99c4f357964 100644 --- a/mysql-test/main/bool.result +++ b/mysql-test/main/bool.result @@ -86,3 +86,256 @@ N 1 N 0 N N N 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 drop table t1; +# Start of 10.6 tests +# +# MDEV-34189 Unexpected error on `WHERE inet6col` +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INT, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,seq FROM seq_0_to_31; +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a; +id a +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a; +id a +0 0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a IS TRUE; +id a +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id a +-1 NULL +0 0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id a +-1 NULL +0 0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id a +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE a IS FALSE; +id a +0 0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id a +-1 NULL +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id a +-1 NULL +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id a +0 0 +DROP TABLE t1; +# End of 10.6 tests diff --git a/mysql-test/main/bool.test b/mysql-test/main/bool.test index d79e3e36762..35d1d28cfe9 100644 --- a/mysql-test/main/bool.test +++ b/mysql-test/main/bool.test @@ -1,3 +1,4 @@ +--source include/have_sequence.inc # # Test of boolean operations with NULL # @@ -62,3 +63,18 @@ select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as n drop table t1; # End of 4.1 tests + + +--echo # Start of 10.6 tests + +--echo # +--echo # MDEV-34189 Unexpected error on `WHERE inet6col` +--echo # + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INT, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,seq FROM seq_0_to_31; +--source include/boolean_factor.inc +DROP TABLE t1; + +--echo # End of 10.6 tests diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 6ba517c5712..e704d4812ed 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -6809,8 +6809,8 @@ SET last_insert_id=0; SELECT * FROM t1 WHERE RPAD(a, 50, LAST_INSERT_ID()); a Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'foo00000000000000000000000000000000000000000000000' -Warning 1292 Truncated incorrect DOUBLE value: 'bar00000000000000000000000000000000000000000000000' +Warning 1292 Truncated incorrect BOOLEAN value: 'foo00000000000000000000000000000000000000000000000' +Warning 1292 Truncated incorrect BOOLEAN value: 'bar00000000000000000000000000000000000000000000000' DROP TABLE t1; SET names latin1; # diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 5984b3ac528..2037b701c6d 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -755,6 +755,9 @@ create table t1(a double not null); insert into t1 values (2),(1); select 1 from t1 where json_extract(a,'$','$[81]'); 1 +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: '[2]' +Warning 1292 Truncated incorrect BOOLEAN value: '[1]' drop table t1; select json_extract('{"test":8.437e-5}','$.test'); json_extract('{"test":8.437e-5}','$.test') diff --git a/mysql-test/main/func_test.result b/mysql-test/main/func_test.result index 261922003d5..609b5f12276 100644 --- a/mysql-test/main/func_test.result +++ b/mysql-test/main/func_test.result @@ -296,7 +296,7 @@ explain extended select * from t1 where not a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false select not (a+0) from t1; not (a+0) 0 diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result index 2b0c88ca7dd..f38839f393e 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -524,7 +524,7 @@ ORDER BY t1.f2; MAX(t2.f2) NULL Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' DROP TABLE t1,t2; End of 5.0 tests # diff --git a/mysql-test/main/insert_innodb.result b/mysql-test/main/insert_innodb.result index b8f3979d2ba..174a749a504 100644 --- a/mysql-test/main/insert_innodb.result +++ b/mysql-test/main/insert_innodb.result @@ -49,9 +49,14 @@ DROP TABLE t2, t1; # CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; ERROR HY000: Field 'v1' doesn't have a default value +SET @@sql_mode=''; CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb REPLACE SELECT NULL AS a; ERROR 23000: CONSTRAINT `t1.i` failed for `test`.`t1` +SET @@sql_mode=DEFAULT; +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb +REPLACE SELECT NULL AS a; +ERROR 22007: Truncated incorrect BOOLEAN value: '' # # End of 10.5 tests # diff --git a/mysql-test/main/insert_innodb.test b/mysql-test/main/insert_innodb.test index 56ddb2eafbf..c975a4d89ab 100644 --- a/mysql-test/main/insert_innodb.test +++ b/mysql-test/main/insert_innodb.test @@ -71,10 +71,16 @@ DROP TABLE t2, t1; --error ER_NO_DEFAULT_FOR_FIELD CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; +SET @@sql_mode=''; --error ER_CONSTRAINT_FAILED CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb REPLACE SELECT NULL AS a; +SET @@sql_mode=DEFAULT; +--error ER_TRUNCATED_WRONG_VALUE +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb + REPLACE SELECT NULL AS a; + --echo # --echo # End of 10.5 tests diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index e32e808a6e2..c7cc21b31c5 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -3946,8 +3946,8 @@ ORDER BY t2.v; MAX(t1.i) NULL Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'x' -Warning 1292 Truncated incorrect DECIMAL value: 'y' +Warning 1292 Truncated incorrect BOOLEAN value: 'x' +Warning 1292 Truncated incorrect BOOLEAN value: 'y' EXPLAIN SELECT MAX(t1.i) diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index b990b72765a..97452bb7a59 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -1387,7 +1387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` is true and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 RIGHT JOIN t1 AS jt2 RIGHT JOIN t1 AS jt3 @@ -1404,7 +1404,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index 1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` is true and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; # # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index 24c3c62719f..53d510b18ec 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -1394,7 +1394,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` is true and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 RIGHT JOIN t1 AS jt2 RIGHT JOIN t1 AS jt3 @@ -1411,7 +1411,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) 1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: -Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 +Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` is true and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; # # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field diff --git a/mysql-test/main/negation_elimination.result b/mysql-test/main/negation_elimination.result index 7b9a76d86b2..ef3bc54b7be 100644 --- a/mysql-test/main/negation_elimination.result +++ b/mysql-test/main/negation_elimination.result @@ -502,5 +502,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like " id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` <> 0 AS `not(not(a))`,`test`.`t1`.`a` > 2 or `test`.`t1`.`a` <> 0 AS `not(a <= 2 and not(a))`,`test`.`t1`.`a` like '1' AS `not(a not like "1")`,`test`.`t1`.`a` in (1,2) AS `not (a not in (1,2))`,`test`.`t1`.`a` = 2 AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` <> 0 having `test`.`t1`.`a` <> 0 +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` <> 0 AS `not(not(a))`,`test`.`t1`.`a` > 2 or `test`.`t1`.`a` <> 0 AS `not(a <= 2 and not(a))`,`test`.`t1`.`a` like '1' AS `not(a not like "1")`,`test`.`t1`.`a` in (1,2) AS `not (a not in (1,2))`,`test`.`t1`.`a` = 2 AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` is true having `test`.`t1`.`a` is true drop table t1; diff --git a/mysql-test/main/precedence.result b/mysql-test/main/precedence.result index fc6579651b4..0d34dbe107a 100644 --- a/mysql-test/main/precedence.result +++ b/mysql-test/main/precedence.result @@ -1,14 +1,14 @@ create or replace view v1 as select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; view_definition -select !(NULL is true) AS `NOT NULL IS TRUE`,!(NULL is true) AS `NOT (NULL IS TRUE)`,!NULL is true AS `(NOT NULL) IS TRUE` +select NULL is not true AS `NOT NULL IS TRUE`,NULL is not true AS `NOT (NULL IS TRUE)`,!NULL is true AS `(NOT NULL) IS TRUE` select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE union select * from v1; NOT NULL IS TRUE NOT (NULL IS TRUE) (NOT NULL) IS TRUE 1 1 0 create or replace view v1 as select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; view_definition -select !NULL is true AS `! NULL IS TRUE`,!(NULL is true) AS `! (NULL IS TRUE)`,!NULL is true AS `(! NULL) IS TRUE` +select !NULL is true AS `! NULL IS TRUE`,NULL is not true AS `! (NULL IS TRUE)`,!NULL is true AS `(! NULL) IS TRUE` select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE union select * from v1; ! NULL IS TRUE ! (NULL IS TRUE) (! NULL) IS TRUE 0 1 0 diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 81ced04e8ca..83aa305e23b 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -5310,11 +5310,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'z' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'q' -Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect BOOLEAN value: 'z' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'q' +Warning 1292 Truncated incorrect BOOLEAN value: 'm' +Warning 1292 Truncated incorrect BOOLEAN value: 'j' DROP TABLE CC; # End of test#45227 # diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index 9f0a239f3b4..6c67062d7f0 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -5322,11 +5322,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'j' -Warning 1292 Truncated incorrect DECIMAL value: 'z' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'q' -Warning 1292 Truncated incorrect DECIMAL value: 'm' +Warning 1292 Truncated incorrect BOOLEAN value: 'j' +Warning 1292 Truncated incorrect BOOLEAN value: 'z' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'q' +Warning 1292 Truncated incorrect BOOLEAN value: 'm' DROP TABLE CC; # End of test#45227 # diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 81ced04e8ca..83aa305e23b 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -5310,11 +5310,11 @@ SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'z' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'q' -Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1292 Truncated incorrect DECIMAL value: 'j' +Warning 1292 Truncated incorrect BOOLEAN value: 'z' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'q' +Warning 1292 Truncated incorrect BOOLEAN value: 'm' +Warning 1292 Truncated incorrect BOOLEAN value: 'j' DROP TABLE CC; # End of test#45227 # diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 4d128e398a6..2d1a5f04d84 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -1649,7 +1649,7 @@ WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f f1 f2 8 8 Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'u' +Warning 1292 Truncated incorrect BOOLEAN value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); id select_type table type possible_keys key key_len ref rows Extra @@ -1683,7 +1683,7 @@ WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f f1 f2 8 8 Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'u' +Warning 1292 Truncated incorrect BOOLEAN value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); id select_type table type possible_keys key key_len ref rows Extra @@ -1875,8 +1875,8 @@ WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); col_int_key Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'v' -Warning 1292 Truncated incorrect DECIMAL value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'v' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' set @@optimizer_switch='subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT col_int_key @@ -1902,8 +1902,8 @@ WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); col_int_key Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'v' -Warning 1292 Truncated incorrect DECIMAL value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'v' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' drop table t1, t2; set @@optimizer_switch = @old_optimizer_switch; # diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index cc670480165..c8fdc552454 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -2972,70 +2972,70 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL w 1 NULL y Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' SET @@optimizer_switch='subquery_cache=on'; /* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , ( SELECT SUBQUERY2_t1 .`col_int_key` @@ -3063,32 +3063,32 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL w 1 NULL y Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'a' -Warning 1292 Truncated incorrect DECIMAL value: 'b' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1292 Truncated incorrect DECIMAL value: 'e' -Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1292 Truncated incorrect DECIMAL value: 'g' -Warning 1292 Truncated incorrect DECIMAL value: 'h' -Warning 1292 Truncated incorrect DECIMAL value: 'i' -Warning 1292 Truncated incorrect DECIMAL value: 'j' -Warning 1292 Truncated incorrect DECIMAL value: 'k' -Warning 1292 Truncated incorrect DECIMAL value: 'l' -Warning 1292 Truncated incorrect DECIMAL value: 'm' -Warning 1292 Truncated incorrect DECIMAL value: 'n' -Warning 1292 Truncated incorrect DECIMAL value: 'o' -Warning 1292 Truncated incorrect DECIMAL value: 'p' -Warning 1292 Truncated incorrect DECIMAL value: 'q' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 's' -Warning 1292 Truncated incorrect DECIMAL value: 't' -Warning 1292 Truncated incorrect DECIMAL value: 'u' -Warning 1292 Truncated incorrect DECIMAL value: 'v' -Warning 1292 Truncated incorrect DECIMAL value: 'w' -Warning 1292 Truncated incorrect DECIMAL value: 'x' -Warning 1292 Truncated incorrect DECIMAL value: 'y' -Warning 1292 Truncated incorrect DECIMAL value: 'z' +Warning 1292 Truncated incorrect BOOLEAN value: 'a' +Warning 1292 Truncated incorrect BOOLEAN value: 'b' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'e' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'g' +Warning 1292 Truncated incorrect BOOLEAN value: 'h' +Warning 1292 Truncated incorrect BOOLEAN value: 'i' +Warning 1292 Truncated incorrect BOOLEAN value: 'j' +Warning 1292 Truncated incorrect BOOLEAN value: 'k' +Warning 1292 Truncated incorrect BOOLEAN value: 'l' +Warning 1292 Truncated incorrect BOOLEAN value: 'm' +Warning 1292 Truncated incorrect BOOLEAN value: 'n' +Warning 1292 Truncated incorrect BOOLEAN value: 'o' +Warning 1292 Truncated incorrect BOOLEAN value: 'p' +Warning 1292 Truncated incorrect BOOLEAN value: 'q' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 's' +Warning 1292 Truncated incorrect BOOLEAN value: 't' +Warning 1292 Truncated incorrect BOOLEAN value: 'u' +Warning 1292 Truncated incorrect BOOLEAN value: 'v' +Warning 1292 Truncated incorrect BOOLEAN value: 'w' +Warning 1292 Truncated incorrect BOOLEAN value: 'x' +Warning 1292 Truncated incorrect BOOLEAN value: 'y' +Warning 1292 Truncated incorrect BOOLEAN value: 'z' drop table t1,t2,t3,t4; set @@optimizer_switch= default; #launchpad BUG#609045 @@ -3513,9 +3513,9 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL d 1 NULL f Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' SET @@optimizer_switch = 'subquery_cache=on'; /* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , ( SELECT SUBQUERY2_t1 .`col_int_key` @@ -3530,9 +3530,9 @@ WHERE table1 .`col_varchar_key` ) field10 1 NULL d 1 NULL f Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1292 Truncated incorrect DECIMAL value: 'f' -Warning 1292 Truncated incorrect DECIMAL value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' +Warning 1292 Truncated incorrect BOOLEAN value: 'f' drop table t1,t2,t3,t4; set @@optimizer_switch= default; #launchpad BUG#611625 diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result index ac9639131f2..d63e1819fa8 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.result +++ b/mysql-test/main/subselect_mat_cost_bugs.result @@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ref c3 c3 4 test.t1b.c4 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t2`.`c3` = `test`.`t1b`.`c4` and `test`.`t1`.`pk` <> 0 and (`test`.`t1`.`c1`) = `test`.`t1a`.`c1`))) +Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <`test`.`t1`.`c1`,`test`.`t1`.`pk`>((`test`.`t1`.`c1`,(/* select#2 */ select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t2`.`c3` = `test`.`t1b`.`c4` and `test`.`t1`.`pk` is true and (`test`.`t1`.`c1`) = `test`.`t1a`.`c1`))) SELECT pk FROM t1 WHERE c1 IN diff --git a/mysql-test/main/type_temporal_innodb.result b/mysql-test/main/type_temporal_innodb.result index f801baceb83..a03769b3f7f 100644 --- a/mysql-test/main/type_temporal_innodb.result +++ b/mysql-test/main/type_temporal_innodb.result @@ -183,7 +183,7 @@ INSERT INTO t1 VALUES ('2024-02-29'); SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f)); f Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '' DROP TABLE t1; # # End of 10.4 tests diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index b6b41b1da69..cacb533bcca 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -3810,7 +3810,7 @@ CREATE TABLE t1 (c INT); CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column` <> 0 latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column` is true latin1 latin1_swedish_ci SELECT * FROM v1; view_column diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 8a28a217756..56d3c9aef16 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3546,20 +3546,28 @@ GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; BIT_OR(100) OVER () +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' explain SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; BIT_OR(100) OVER () +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' create table t1 (a int); explain SELECT DISTINCT BIT_OR(100) OVER () FROM t1 diff --git a/mysql-test/main/xtradb_mrr.result b/mysql-test/main/xtradb_mrr.result index fb7c01c04a6..b99d34890f0 100644 --- a/mysql-test/main/xtradb_mrr.result +++ b/mysql-test/main/xtradb_mrr.result @@ -441,18 +441,18 @@ SELECT table1 .`col_varchar_key` FROM t1 table1 STRAIGHT_JOIN ( t1 table3 JOIN t1 table4 ON table4 .`pk` = table3 .`col_int_nokey` ) ON table4 .`col_varchar_nokey` ; col_varchar_key Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'r' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'c' -Warning 1292 Truncated incorrect DECIMAL value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'r' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' +Warning 1292 Truncated incorrect BOOLEAN value: 'c' DROP TABLE t1; set join_cache_level=@save_join_cache_level; set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index a37d47fb479..072b7a71413 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3552,20 +3552,28 @@ GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; BIT_OR(100) OVER () +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' explain SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; BIT_OR(100) OVER () +Warnings: +Warning 1292 Truncated incorrect BOOLEAN value: 'qwerty' create table t1 (a int); explain SELECT DISTINCT BIT_OR(100) OVER () FROM t1 diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 094a0fec46d..c822db1340f 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -2099,9 +2099,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2115,9 +2115,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -2133,10 +2133,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2150,10 +2150,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' DROP VIEW v1; @@ -2169,9 +2169,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2185,9 +2185,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2203,9 +2203,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2219,9 +2219,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index d4fe96a6ea6..6268ad96b13 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -2100,9 +2100,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2116,9 +2116,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -2134,10 +2134,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2151,10 +2151,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' DROP VIEW v1; @@ -2170,9 +2170,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2186,9 +2186,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2204,9 +2204,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2220,9 +2220,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index d4fe96a6ea6..6268ad96b13 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -2100,9 +2100,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2116,9 +2116,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -2134,10 +2134,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2151,10 +2151,10 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect BOOLEAN value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' DROP VIEW v1; @@ -2170,9 +2170,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2186,9 +2186,9 @@ IS NOT TRUE <---------1000 characters------------------------------------------- IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<---------1000 characters----------------------------------------------------------------------------------------------------...' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2204,9 +2204,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2220,9 +2220,9 @@ IS NOT TRUE <--------30 characters-------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '' -Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' -Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--' +Warning 1292 Truncated incorrect BOOLEAN value: '' +Warning 1292 Truncated incorrect BOOLEAN value: '<--------30 characters------->' +Warning 1292 Truncated incorrect BOOLEAN value: ' ---äÖüß@µ*$--' DROP VIEW v1; diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result index a11feec1ad8..b001e048341 100644 --- a/mysql-test/suite/maria/mrr.result +++ b/mysql-test/suite/maria/mrr.result @@ -326,10 +326,10 @@ SELECT table2 .`col_datetime_key` FROM t2 JOIN ( t1 table2 JOIN t2 table3 ON table3 .`col_varchar_key` < table2 .`col_varchar_key` ) ON table3 .`col_varchar_nokey` ; col_datetime_key Warnings: -Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1292 Truncated incorrect DECIMAL value: 'd' -Warning 1292 Truncated incorrect DECIMAL value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' +Warning 1292 Truncated incorrect BOOLEAN value: 'd' drop table t1, t2; set join_cache_level=@save_join_cache_level; CREATE TABLE t1( diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4.result b/plugin/type_inet/mysql-test/type_inet/type_inet4.result index acbd0cd2be7..6fc949e36fa 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet4.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet4.result @@ -1911,9 +1911,9 @@ a b foo 0.0.0.0 bar 1.0.0.1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect BOOLEAN value: 'foo' Warning 1292 Incorrect inet4 value: 'foo' -Warning 1292 Truncated incorrect DOUBLE value: 'bar' +Warning 1292 Truncated incorrect BOOLEAN value: 'bar' Warning 1292 Incorrect inet4 value: 'bar' DROP TABLE t1; CREATE OR REPLACE TABLE t1 (a VARCHAR(8) NOT NULL); @@ -2029,3 +2029,256 @@ DROP TABLE t1; # # End of 10.10 tests # +# Start of 11.8 tests +# +# MDEV-34189 Unexpected error on `WHERE inet6col` +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INET4, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,CONCAT('0.0.0.',seq) FROM seq_0_to_31; +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a; +id a +1 0.0.0.1 +2 0.0.0.2 +3 0.0.0.3 +4 0.0.0.4 +5 0.0.0.5 +6 0.0.0.6 +7 0.0.0.7 +8 0.0.0.8 +9 0.0.0.9 +10 0.0.0.10 +11 0.0.0.11 +12 0.0.0.12 +13 0.0.0.13 +14 0.0.0.14 +15 0.0.0.15 +16 0.0.0.16 +17 0.0.0.17 +18 0.0.0.18 +19 0.0.0.19 +20 0.0.0.20 +21 0.0.0.21 +22 0.0.0.22 +23 0.0.0.23 +24 0.0.0.24 +25 0.0.0.25 +26 0.0.0.26 +27 0.0.0.27 +28 0.0.0.28 +29 0.0.0.29 +30 0.0.0.30 +31 0.0.0.31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a; +id a +0 0.0.0.0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a IS TRUE; +id a +1 0.0.0.1 +2 0.0.0.2 +3 0.0.0.3 +4 0.0.0.4 +5 0.0.0.5 +6 0.0.0.6 +7 0.0.0.7 +8 0.0.0.8 +9 0.0.0.9 +10 0.0.0.10 +11 0.0.0.11 +12 0.0.0.12 +13 0.0.0.13 +14 0.0.0.14 +15 0.0.0.15 +16 0.0.0.16 +17 0.0.0.17 +18 0.0.0.18 +19 0.0.0.19 +20 0.0.0.20 +21 0.0.0.21 +22 0.0.0.22 +23 0.0.0.23 +24 0.0.0.24 +25 0.0.0.25 +26 0.0.0.26 +27 0.0.0.27 +28 0.0.0.28 +29 0.0.0.29 +30 0.0.0.30 +31 0.0.0.31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id a +-1 NULL +0 0.0.0.0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id a +-1 NULL +0 0.0.0.0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id a +1 0.0.0.1 +2 0.0.0.2 +3 0.0.0.3 +4 0.0.0.4 +5 0.0.0.5 +6 0.0.0.6 +7 0.0.0.7 +8 0.0.0.8 +9 0.0.0.9 +10 0.0.0.10 +11 0.0.0.11 +12 0.0.0.12 +13 0.0.0.13 +14 0.0.0.14 +15 0.0.0.15 +16 0.0.0.16 +17 0.0.0.17 +18 0.0.0.18 +19 0.0.0.19 +20 0.0.0.20 +21 0.0.0.21 +22 0.0.0.22 +23 0.0.0.23 +24 0.0.0.24 +25 0.0.0.25 +26 0.0.0.26 +27 0.0.0.27 +28 0.0.0.28 +29 0.0.0.29 +30 0.0.0.30 +31 0.0.0.31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE a IS FALSE; +id a +0 0.0.0.0 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id a +-1 NULL +1 0.0.0.1 +2 0.0.0.2 +3 0.0.0.3 +4 0.0.0.4 +5 0.0.0.5 +6 0.0.0.6 +7 0.0.0.7 +8 0.0.0.8 +9 0.0.0.9 +10 0.0.0.10 +11 0.0.0.11 +12 0.0.0.12 +13 0.0.0.13 +14 0.0.0.14 +15 0.0.0.15 +16 0.0.0.16 +17 0.0.0.17 +18 0.0.0.18 +19 0.0.0.19 +20 0.0.0.20 +21 0.0.0.21 +22 0.0.0.22 +23 0.0.0.23 +24 0.0.0.24 +25 0.0.0.25 +26 0.0.0.26 +27 0.0.0.27 +28 0.0.0.28 +29 0.0.0.29 +30 0.0.0.30 +31 0.0.0.31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id a +-1 NULL +1 0.0.0.1 +2 0.0.0.2 +3 0.0.0.3 +4 0.0.0.4 +5 0.0.0.5 +6 0.0.0.6 +7 0.0.0.7 +8 0.0.0.8 +9 0.0.0.9 +10 0.0.0.10 +11 0.0.0.11 +12 0.0.0.12 +13 0.0.0.13 +14 0.0.0.14 +15 0.0.0.15 +16 0.0.0.16 +17 0.0.0.17 +18 0.0.0.18 +19 0.0.0.19 +20 0.0.0.20 +21 0.0.0.21 +22 0.0.0.22 +23 0.0.0.23 +24 0.0.0.24 +25 0.0.0.25 +26 0.0.0.26 +27 0.0.0.27 +28 0.0.0.28 +29 0.0.0.29 +30 0.0.0.30 +31 0.0.0.31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id a +0 0.0.0.0 +DROP TABLE t1; +# End of 11.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4.test b/plugin/type_inet/mysql-test/type_inet/type_inet4.test index 8bb2a8259f8..1d71b86f9be 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet4.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet4.test @@ -1,3 +1,5 @@ +--source include/have_sequence.inc + --echo # --echo # Start of 10.10 tests --echo # @@ -1479,3 +1481,17 @@ DROP TABLE t1; --echo # --echo # End of 10.10 tests --echo # + +--echo # Start of 11.8 tests + +--echo # +--echo # MDEV-34189 Unexpected error on `WHERE inet6col` +--echo # + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INET4, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,CONCAT('0.0.0.',seq) FROM seq_0_to_31; +--source include/boolean_factor.inc +DROP TABLE t1; + +--echo # End of 11.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index 9eb7f3814ba..3a4ea04b5d1 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -868,7 +868,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('::'),('::1'),('::2'); SELECT * FROM t1 WHERE a; -ERROR HY000: Illegal parameter data types inet6 and bigint for operation '<>' +a +::1 +::2 +SELECT * FROM t1 WHERE NOT a; +a +:: DROP TABLE t1; # # GROUP BY @@ -2091,9 +2096,9 @@ a b foo :: bar 1::1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect BOOLEAN value: 'foo' Warning 1292 Incorrect inet6 value: 'foo' -Warning 1292 Truncated incorrect DOUBLE value: 'bar' +Warning 1292 Truncated incorrect BOOLEAN value: 'bar' Warning 1292 Incorrect inet6 value: 'bar' DROP TABLE t1; CREATE OR REPLACE TABLE t1 (a VARCHAR(8) NOT NULL); @@ -2419,3 +2424,256 @@ f::f DROP TABLE t1; SET max_sort_length=DEFAULT; # End of 10.8 tests +# Start of 11.8 tests +# +# MDEV-34189 Unexpected error on `WHERE inet6col` +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INET6, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,CONCAT('::',seq) FROM seq_0_to_31; +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a; +id a +1 ::1 +2 ::2 +3 ::3 +4 ::4 +5 ::5 +6 ::6 +7 ::7 +8 ::8 +9 ::9 +10 ::10 +11 ::11 +12 ::12 +13 ::13 +14 ::14 +15 ::15 +16 ::16 +17 ::17 +18 ::18 +19 ::19 +20 ::20 +21 ::21 +22 ::22 +23 ::23 +24 ::24 +25 ::25 +26 ::26 +27 ::27 +28 ::28 +29 ::29 +30 ::30 +31 ::31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a; +id a +0 :: +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a IS TRUE; +id a +1 ::1 +2 ::2 +3 ::3 +4 ::4 +5 ::5 +6 ::6 +7 ::7 +8 ::8 +9 ::9 +10 ::10 +11 ::11 +12 ::12 +13 ::13 +14 ::14 +15 ::15 +16 ::16 +17 ::17 +18 ::18 +19 ::19 +20 ::20 +21 ::21 +22 ::22 +23 ::23 +24 ::24 +25 ::25 +26 ::26 +27 ::27 +28 ::28 +29 ::29 +30 ::30 +31 ::31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id a +-1 NULL +0 :: +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id a +-1 NULL +0 :: +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id a +1 ::1 +2 ::2 +3 ::3 +4 ::4 +5 ::5 +6 ::6 +7 ::7 +8 ::8 +9 ::9 +10 ::10 +11 ::11 +12 ::12 +13 ::13 +14 ::14 +15 ::15 +16 ::16 +17 ::17 +18 ::18 +19 ::19 +20 ::20 +21 ::21 +22 ::22 +23 ::23 +24 ::24 +25 ::25 +26 ::26 +27 ::27 +28 ::28 +29 ::29 +30 ::30 +31 ::31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE a IS FALSE; +id a +0 :: +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id a +-1 NULL +1 ::1 +2 ::2 +3 ::3 +4 ::4 +5 ::5 +6 ::6 +7 ::7 +8 ::8 +9 ::9 +10 ::10 +11 ::11 +12 ::12 +13 ::13 +14 ::14 +15 ::15 +16 ::16 +17 ::17 +18 ::18 +19 ::19 +20 ::20 +21 ::21 +22 ::22 +23 ::23 +24 ::24 +25 ::25 +26 ::26 +27 ::27 +28 ::28 +29 ::29 +30 ::30 +31 ::31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id a +-1 NULL +1 ::1 +2 ::2 +3 ::3 +4 ::4 +5 ::5 +6 ::6 +7 ::7 +8 ::8 +9 ::9 +10 ::10 +11 ::11 +12 ::12 +13 ::13 +14 ::14 +15 ::15 +16 ::16 +17 ::17 +18 ::18 +19 ::19 +20 ::20 +21 ::21 +22 ::22 +23 ::23 +24 ::24 +25 ::25 +26 ::26 +27 ::27 +28 ::28 +29 ::29 +30 ::30 +31 ::31 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id a +0 :: +DROP TABLE t1; +# End of 11.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index c3128140b71..45e55d02ea7 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1,3 +1,5 @@ +--source include/have_sequence.inc + --echo # --echo # Basic CREATE functionality, defaults, metadata --echo # @@ -488,14 +490,10 @@ INSERT INTO t1 VALUES ('::'),('::1'); SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a; DROP TABLE t1; -# -# TODO: Error looks like a bug. This should return rows where a<>'::'. -# The same problem is repeatable with GEOMETRY. -# CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('::'),('::1'),('::2'); ---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT * FROM t1 WHERE a; +SELECT * FROM t1 WHERE NOT a; DROP TABLE t1; @@ -1741,3 +1739,17 @@ DROP TABLE t1; SET max_sort_length=DEFAULT; --echo # End of 10.8 tests + +--echo # Start of 11.8 tests + +--echo # +--echo # MDEV-34189 Unexpected error on `WHERE inet6col` +--echo # + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a INET6, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 SELECT seq,CONCAT('::',seq) FROM seq_0_to_31; +--source include/boolean_factor.inc +DROP TABLE t1; + +--echo # End of 11.8 tests diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result index 03fb482ca23..17cfc8196c0 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -1983,8 +1983,13 @@ INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'), ('00000000-0000-0000-0000-000000000001'), ('00000000-0000-0000-0000-000000000002'); -SELECT * FROM t1 WHERE a; -ERROR HY000: Illegal parameter data types uuid and bigint for operation '<>' +SELECT * FROM t1 WHERE a ORDER BY a; +a +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE NOT a; +a +00000000-0000-0000-0000-000000000000 DROP TABLE t1; # # GROUP BY @@ -3214,3 +3219,258 @@ Warnings: Warning 1292 Incorrect uuid value: '' Warning 1292 Incorrect uuid value: '' DROP TABLE t1; +# End of 10.6 tests +# Start of 11.8 tests +# +# MDEV-34189 Unexpected error on `WHERE inet6col` +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a UUID, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 VALUES (0,'00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 SELECT seq,concat('ba2f21be-d306-11ef-ab9e-', lpad(seq,12,'0')) FROM seq_1_to_31; +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a; +id a +1 ba2f21be-d306-11ef-ab9e-000000000001 +2 ba2f21be-d306-11ef-ab9e-000000000002 +3 ba2f21be-d306-11ef-ab9e-000000000003 +4 ba2f21be-d306-11ef-ab9e-000000000004 +5 ba2f21be-d306-11ef-ab9e-000000000005 +6 ba2f21be-d306-11ef-ab9e-000000000006 +7 ba2f21be-d306-11ef-ab9e-000000000007 +8 ba2f21be-d306-11ef-ab9e-000000000008 +9 ba2f21be-d306-11ef-ab9e-000000000009 +10 ba2f21be-d306-11ef-ab9e-000000000010 +11 ba2f21be-d306-11ef-ab9e-000000000011 +12 ba2f21be-d306-11ef-ab9e-000000000012 +13 ba2f21be-d306-11ef-ab9e-000000000013 +14 ba2f21be-d306-11ef-ab9e-000000000014 +15 ba2f21be-d306-11ef-ab9e-000000000015 +16 ba2f21be-d306-11ef-ab9e-000000000016 +17 ba2f21be-d306-11ef-ab9e-000000000017 +18 ba2f21be-d306-11ef-ab9e-000000000018 +19 ba2f21be-d306-11ef-ab9e-000000000019 +20 ba2f21be-d306-11ef-ab9e-000000000020 +21 ba2f21be-d306-11ef-ab9e-000000000021 +22 ba2f21be-d306-11ef-ab9e-000000000022 +23 ba2f21be-d306-11ef-ab9e-000000000023 +24 ba2f21be-d306-11ef-ab9e-000000000024 +25 ba2f21be-d306-11ef-ab9e-000000000025 +26 ba2f21be-d306-11ef-ab9e-000000000026 +27 ba2f21be-d306-11ef-ab9e-000000000027 +28 ba2f21be-d306-11ef-ab9e-000000000028 +29 ba2f21be-d306-11ef-ab9e-000000000029 +30 ba2f21be-d306-11ef-ab9e-000000000030 +31 ba2f21be-d306-11ef-ab9e-000000000031 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a; +id a +0 00000000-0000-0000-0000-000000000000 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE a IS TRUE; +id a +1 ba2f21be-d306-11ef-ab9e-000000000001 +2 ba2f21be-d306-11ef-ab9e-000000000002 +3 ba2f21be-d306-11ef-ab9e-000000000003 +4 ba2f21be-d306-11ef-ab9e-000000000004 +5 ba2f21be-d306-11ef-ab9e-000000000005 +6 ba2f21be-d306-11ef-ab9e-000000000006 +7 ba2f21be-d306-11ef-ab9e-000000000007 +8 ba2f21be-d306-11ef-ab9e-000000000008 +9 ba2f21be-d306-11ef-ab9e-000000000009 +10 ba2f21be-d306-11ef-ab9e-000000000010 +11 ba2f21be-d306-11ef-ab9e-000000000011 +12 ba2f21be-d306-11ef-ab9e-000000000012 +13 ba2f21be-d306-11ef-ab9e-000000000013 +14 ba2f21be-d306-11ef-ab9e-000000000014 +15 ba2f21be-d306-11ef-ab9e-000000000015 +16 ba2f21be-d306-11ef-ab9e-000000000016 +17 ba2f21be-d306-11ef-ab9e-000000000017 +18 ba2f21be-d306-11ef-ab9e-000000000018 +19 ba2f21be-d306-11ef-ab9e-000000000019 +20 ba2f21be-d306-11ef-ab9e-000000000020 +21 ba2f21be-d306-11ef-ab9e-000000000021 +22 ba2f21be-d306-11ef-ab9e-000000000022 +23 ba2f21be-d306-11ef-ab9e-000000000023 +24 ba2f21be-d306-11ef-ab9e-000000000024 +25 ba2f21be-d306-11ef-ab9e-000000000025 +26 ba2f21be-d306-11ef-ab9e-000000000026 +27 ba2f21be-d306-11ef-ab9e-000000000027 +28 ba2f21be-d306-11ef-ab9e-000000000028 +29 ba2f21be-d306-11ef-ab9e-000000000029 +30 ba2f21be-d306-11ef-ab9e-000000000030 +31 ba2f21be-d306-11ef-ab9e-000000000031 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE NOT a IS TRUE; +id a +-1 NULL +0 00000000-0000-0000-0000-000000000000 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 2 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not true +SELECT id, a FROM t1 WHERE a IS NOT TRUE; +id a +-1 NULL +0 00000000-0000-0000-0000-000000000000 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is true +SELECT id, a FROM t1 WHERE NOT a IS NOT TRUE; +id a +1 ba2f21be-d306-11ef-ab9e-000000000001 +2 ba2f21be-d306-11ef-ab9e-000000000002 +3 ba2f21be-d306-11ef-ab9e-000000000003 +4 ba2f21be-d306-11ef-ab9e-000000000004 +5 ba2f21be-d306-11ef-ab9e-000000000005 +6 ba2f21be-d306-11ef-ab9e-000000000006 +7 ba2f21be-d306-11ef-ab9e-000000000007 +8 ba2f21be-d306-11ef-ab9e-000000000008 +9 ba2f21be-d306-11ef-ab9e-000000000009 +10 ba2f21be-d306-11ef-ab9e-000000000010 +11 ba2f21be-d306-11ef-ab9e-000000000011 +12 ba2f21be-d306-11ef-ab9e-000000000012 +13 ba2f21be-d306-11ef-ab9e-000000000013 +14 ba2f21be-d306-11ef-ab9e-000000000014 +15 ba2f21be-d306-11ef-ab9e-000000000015 +16 ba2f21be-d306-11ef-ab9e-000000000016 +17 ba2f21be-d306-11ef-ab9e-000000000017 +18 ba2f21be-d306-11ef-ab9e-000000000018 +19 ba2f21be-d306-11ef-ab9e-000000000019 +20 ba2f21be-d306-11ef-ab9e-000000000020 +21 ba2f21be-d306-11ef-ab9e-000000000021 +22 ba2f21be-d306-11ef-ab9e-000000000022 +23 ba2f21be-d306-11ef-ab9e-000000000023 +24 ba2f21be-d306-11ef-ab9e-000000000024 +25 ba2f21be-d306-11ef-ab9e-000000000025 +26 ba2f21be-d306-11ef-ab9e-000000000026 +27 ba2f21be-d306-11ef-ab9e-000000000027 +28 ba2f21be-d306-11ef-ab9e-000000000028 +29 ba2f21be-d306-11ef-ab9e-000000000029 +30 ba2f21be-d306-11ef-ab9e-000000000030 +31 ba2f21be-d306-11ef-ab9e-000000000031 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE a IS FALSE; +id a +0 00000000-0000-0000-0000-000000000000 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE NOT a IS FALSE; +id a +-1 NULL +1 ba2f21be-d306-11ef-ab9e-000000000001 +2 ba2f21be-d306-11ef-ab9e-000000000002 +3 ba2f21be-d306-11ef-ab9e-000000000003 +4 ba2f21be-d306-11ef-ab9e-000000000004 +5 ba2f21be-d306-11ef-ab9e-000000000005 +6 ba2f21be-d306-11ef-ab9e-000000000006 +7 ba2f21be-d306-11ef-ab9e-000000000007 +8 ba2f21be-d306-11ef-ab9e-000000000008 +9 ba2f21be-d306-11ef-ab9e-000000000009 +10 ba2f21be-d306-11ef-ab9e-000000000010 +11 ba2f21be-d306-11ef-ab9e-000000000011 +12 ba2f21be-d306-11ef-ab9e-000000000012 +13 ba2f21be-d306-11ef-ab9e-000000000013 +14 ba2f21be-d306-11ef-ab9e-000000000014 +15 ba2f21be-d306-11ef-ab9e-000000000015 +16 ba2f21be-d306-11ef-ab9e-000000000016 +17 ba2f21be-d306-11ef-ab9e-000000000017 +18 ba2f21be-d306-11ef-ab9e-000000000018 +19 ba2f21be-d306-11ef-ab9e-000000000019 +20 ba2f21be-d306-11ef-ab9e-000000000020 +21 ba2f21be-d306-11ef-ab9e-000000000021 +22 ba2f21be-d306-11ef-ab9e-000000000022 +23 ba2f21be-d306-11ef-ab9e-000000000023 +24 ba2f21be-d306-11ef-ab9e-000000000024 +25 ba2f21be-d306-11ef-ab9e-000000000025 +26 ba2f21be-d306-11ef-ab9e-000000000026 +27 ba2f21be-d306-11ef-ab9e-000000000027 +28 ba2f21be-d306-11ef-ab9e-000000000028 +29 ba2f21be-d306-11ef-ab9e-000000000029 +30 ba2f21be-d306-11ef-ab9e-000000000030 +31 ba2f21be-d306-11ef-ab9e-000000000031 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL a NULL NULL NULL 33 96.97 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not false +SELECT id, a FROM t1 WHERE a IS NOT FALSE; +id a +-1 NULL +1 ba2f21be-d306-11ef-ab9e-000000000001 +2 ba2f21be-d306-11ef-ab9e-000000000002 +3 ba2f21be-d306-11ef-ab9e-000000000003 +4 ba2f21be-d306-11ef-ab9e-000000000004 +5 ba2f21be-d306-11ef-ab9e-000000000005 +6 ba2f21be-d306-11ef-ab9e-000000000006 +7 ba2f21be-d306-11ef-ab9e-000000000007 +8 ba2f21be-d306-11ef-ab9e-000000000008 +9 ba2f21be-d306-11ef-ab9e-000000000009 +10 ba2f21be-d306-11ef-ab9e-000000000010 +11 ba2f21be-d306-11ef-ab9e-000000000011 +12 ba2f21be-d306-11ef-ab9e-000000000012 +13 ba2f21be-d306-11ef-ab9e-000000000013 +14 ba2f21be-d306-11ef-ab9e-000000000014 +15 ba2f21be-d306-11ef-ab9e-000000000015 +16 ba2f21be-d306-11ef-ab9e-000000000016 +17 ba2f21be-d306-11ef-ab9e-000000000017 +18 ba2f21be-d306-11ef-ab9e-000000000018 +19 ba2f21be-d306-11ef-ab9e-000000000019 +20 ba2f21be-d306-11ef-ab9e-000000000020 +21 ba2f21be-d306-11ef-ab9e-000000000021 +22 ba2f21be-d306-11ef-ab9e-000000000022 +23 ba2f21be-d306-11ef-ab9e-000000000023 +24 ba2f21be-d306-11ef-ab9e-000000000024 +25 ba2f21be-d306-11ef-ab9e-000000000025 +26 ba2f21be-d306-11ef-ab9e-000000000026 +27 ba2f21be-d306-11ef-ab9e-000000000027 +28 ba2f21be-d306-11ef-ab9e-000000000028 +29 ba2f21be-d306-11ef-ab9e-000000000029 +30 ba2f21be-d306-11ef-ab9e-000000000030 +31 ba2f21be-d306-11ef-ab9e-000000000031 +EXPLAIN EXTENDED +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 17 NULL 1 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is false +SELECT id, a FROM t1 WHERE NOT a IS NOT FALSE; +id a +0 00000000-0000-0000-0000-000000000000 +DROP TABLE t1; +# End of 11.8 tests diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index 63b9228c343..2bf06d0535a 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -1,3 +1,5 @@ +--source include/have_sequence.inc + --echo # --echo # MDEV-4958 Adding datatype UUID --echo # @@ -585,17 +587,13 @@ INSERT INTO t1 VALUES SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a; DROP TABLE t1; -# -# TODO: Error looks like a bug. This should return rows where a<>'00000000-0000-0000-0000-000000000000'. -# The same problem is repeatable with GEOMETRY. -# CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'), ('00000000-0000-0000-0000-000000000001'), ('00000000-0000-0000-0000-000000000002'); ---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION -SELECT * FROM t1 WHERE a; +SELECT * FROM t1 WHERE a ORDER BY a; +SELECT * FROM t1 WHERE NOT a; DROP TABLE t1; @@ -1697,3 +1695,20 @@ INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001'); SELECT * FROM t1 WHERE a=''; DROP TABLE t1; + +--echo # End of 10.6 tests + +--echo # Start of 11.8 tests + +--echo # +--echo # MDEV-34189 Unexpected error on `WHERE inet6col` +--echo # + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a UUID, KEY(a)); +INSERT INTO t1 VALUES (-1,NULL); +INSERT INTO t1 VALUES (0,'00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 SELECT seq,concat('ba2f21be-d306-11ef-ab9e-', lpad(seq,12,'0')) FROM seq_1_to_31; +--source include/boolean_factor.inc +DROP TABLE t1; + +--echo # End of 11.8 tests diff --git a/sql/field.cc b/sql/field.cc index 1874cba662a..5843c942923 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1132,6 +1132,20 @@ Field_longstr::pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field) } +bool Field_longstr::val_bool() +{ + DBUG_ASSERT(marked_for_read()); + THD *thd= get_thd(); + StringBuffer str; + val_str(&str, &str); + double res= Converter_strntod_with_warn(thd, Warn_filter(thd), + "BOOLEAN", + charset(), + str.ptr(), str.length()).result(); + return res != 0.0; +} + + /** @brief Determine the relative position of the field value in a numeric interval @@ -7682,11 +7696,26 @@ double Field_string::val_real(void) const LEX_CSTRING str= to_lex_cstring(); return Converter_strntod_with_warn(thd, Warn_filter_string(thd, this), + "DOUBLE", Field_string::charset(), str.str, str.length).result(); } +bool Field_string::val_bool() +{ + DBUG_ASSERT(marked_for_read()); + THD *thd= get_thd(); + const LEX_CSTRING str= to_lex_cstring(); + double res= Converter_strntod_with_warn(thd, + Warn_filter_string(thd, this), + "BOOLEAN", + Field_string::charset(), + str.str, str.length).result(); + return res != 0.0; +} + + longlong Field_string::val_int(void) { DBUG_ASSERT(marked_for_read()); @@ -8090,7 +8119,7 @@ double Field_varstring::val_real(void) { DBUG_ASSERT(marked_for_read()); THD *thd= get_thd(); - return Converter_strntod_with_warn(thd, Warn_filter(thd), + return Converter_strntod_with_warn(thd, Warn_filter(thd), "DOUBLE", Field_varstring::charset(), (const char *) get_data(), get_length()).result(); @@ -8702,7 +8731,8 @@ double Field_varstring_compressed::val_real(void) THD *thd= get_thd(); String buf; val_str(&buf, &buf); - return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset(), + return Converter_strntod_with_warn(thd, Warn_filter(thd), "DOUBLE", + field_charset(), buf.ptr(), buf.length()).result(); } @@ -8926,7 +8956,7 @@ double Field_blob::val_real(void) if (!blob) return 0.0; THD *thd= get_thd(); - return Converter_strntod_with_warn(thd, Warn_filter(thd), + return Converter_strntod_with_warn(thd, Warn_filter(thd), "DOUBLE", Field_blob::charset(), blob, get_length(ptr)).result(); } @@ -9394,7 +9424,8 @@ double Field_blob_compressed::val_real(void) THD *thd= get_thd(); String buf; val_str(&buf, &buf); - return Converter_strntod_with_warn(thd, Warn_filter(thd), field_charset(), + return Converter_strntod_with_warn(thd, Warn_filter(thd), "DOUBLE", + field_charset(), buf.ptr(), buf.length()).result(); } diff --git a/sql/field.h b/sql/field.h index 19080ba8e3a..e112e6a6488 100644 --- a/sql/field.h +++ b/sql/field.h @@ -281,13 +281,16 @@ protected: // String-to-number converters with automatic warning generation class Converter_strntod_with_warn: public Converter_strntod { + const char *m_data_type; public: Converter_strntod_with_warn(THD *thd, Warn_filter filter, + const char *data_type, CHARSET_INFO *cs, const char *str, size_t length) - :Converter_strntod(cs, str, length) + :Converter_strntod(cs, str, length), + m_data_type(data_type) { - check_edom_and_truncation(thd, filter, "DOUBLE", cs, str, length); + check_edom_and_truncation(thd, filter, m_data_type, cs, str, length); } }; @@ -354,7 +357,7 @@ protected: double double_from_string_with_check(CHARSET_INFO *cs, const char *cptr, const char *end) const { - return Converter_strntod_with_warn(NULL, Warn_filter_all(), + return Converter_strntod_with_warn(NULL, Warn_filter_all(), "DOUBLE", cs, cptr, end - cptr).result(); } my_decimal *decimal_from_string_with_check(my_decimal *decimal_value, @@ -2326,7 +2329,7 @@ public: uint32 max_data_length() const override; void make_send_field(Send_field *) override; bool send(Protocol *protocol) override; - + bool val_bool() override; bool is_varchar_and_in_write_set() const override { DBUG_ASSERT(table && table->write_set); @@ -4145,6 +4148,7 @@ public: using Field_str::store; double val_real() override; longlong val_int() override; + bool val_bool() override; String *val_str(String *, String *) override; my_decimal *val_decimal(my_decimal *) override; int cmp(const uchar *,const uchar *) const override; diff --git a/sql/item.cc b/sql/item.cc index 390c82a34d2..36802105c6d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -235,6 +235,22 @@ String *Item::val_string_from_int(String *str) } +bool Item::val_bool_from_str() +{ + StringBuffer buffer; + String *str= val_str(&buffer); + DBUG_ASSERT((str == nullptr) == null_value); + if (!str) + return false; + THD *thd= current_thd; + double res= Converter_strntod_with_warn(thd, Warn_filter_all(), + "BOOLEAN", + str->charset(), + str->ptr(), str->length()).result(); + return res != 0e0; +} + + longlong Item::val_int_from_str(int *error) { char buff[MAX_FIELD_WIDTH]; @@ -3469,6 +3485,15 @@ longlong Item_field::val_int() } +bool Item_field::val_bool() +{ + DBUG_ASSERT(fixed()); + if ((null_value= field->is_null())) + return 0; + return field->val_bool(); +} + + my_decimal *Item_field::val_decimal(my_decimal *decimal_value) { if ((null_value= field->is_null())) @@ -9910,6 +9935,12 @@ void Item_default_value::calculate() DEBUG_SYNC(field->table->in_use, "after_Item_default_value_calculate"); } +bool Item_default_value::val_bool() +{ + calculate(); + return Item_field::val_bool(); +} + bool Item_default_value::val_native(THD *thd, Native *to) { calculate(); diff --git a/sql/item.h b/sql/item.h index 985fdc3db53..0c3589d8a23 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1757,6 +1757,7 @@ public: return Converter_double_to_longlong_with_warn(val_real(), false).result(); } longlong val_int_from_str(int *error); + bool val_bool_from_str(); /* Returns true if this item can be calculated during @@ -3720,6 +3721,7 @@ public: bool eq(const Item *item, bool binary_cmp) const override; double val_real() override; longlong val_int() override; + bool val_bool() override; my_decimal *val_decimal(my_decimal *) override; String *val_str(String*) override; void save_result(Field *to) override; @@ -7011,6 +7013,7 @@ public: bool fix_fields(THD *, Item **) override; void cleanup() override; void print(String *str, enum_query_type query_type) override; + bool val_bool() override; String *val_str(String *str) override; double val_real() override; longlong val_int() override; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0b1a4881a64..c244780835f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1281,6 +1281,37 @@ bool Item_func_truth::val_bool() } +bool Item_func_truth::count_sargable_conds(void *arg) +{ + ((SELECT_LEX*) arg)->cond_count++; + return 0; +} + + +Item *Item_func_istrue::negated_item(THD *thd) const +{ + return new (thd->mem_root) Item_func_isnottrue(thd, args[0]); +} + + +Item *Item_func_isnottrue::negated_item(THD *thd) const +{ + return new (thd->mem_root) Item_func_istrue(thd, args[0]); +} + + +Item *Item_func_isfalse::negated_item(THD *thd) const +{ + return new (thd->mem_root) Item_func_isnotfalse(thd, args[0]); +} + + +Item *Item_func_isnotfalse::negated_item(THD *thd) const +{ + return new (thd->mem_root) Item_func_isfalse(thd, args[0]); +} + + void Item_in_optimizer::fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) { diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 605c6ff883a..2775176d1fb 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -264,6 +264,19 @@ public: bool fix_length_and_dec(THD *thd) override; void print(String *str, enum_query_type query_type) override; enum precedence precedence() const override { return CMP_PRECEDENCE; } + bool count_sargable_conds(void *arg) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, + KEY_PART *key_part, + Item_func::Functype type, Item *value) override; + void add_key_fields(JOIN *join, KEY_FIELD **key_fields, + uint *and_level, table_map usable_tables, + SARGABLE_PARAM **sargables) override; + virtual Item *negated_item(THD *thd) const = 0; + Item *neg_transformer(THD *thd) override + { + return negated_item(thd); + } protected: Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): @@ -298,6 +311,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("istrue") }; return name; } + SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) override; + Item *negated_item(THD *thd) const override; Item *do_get_copy(THD *thd) const override { return get_item_copy(thd, this); } }; @@ -318,6 +334,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isnottrue") }; return name; } + Item *negated_item(THD *thd) const override; + SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) override; bool find_not_null_fields(table_map allowed) override { return false; } Item *do_get_copy(THD *thd) const override { return get_item_copy(thd, this); } @@ -340,6 +359,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isfalse") }; return name; } + Item *negated_item(THD *thd) const override; + SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) override; Item *do_get_copy(THD *thd) const override { return get_item_copy(thd, this); } }; @@ -360,7 +382,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isnotfalse") }; return name; } + Item *negated_item(THD *thd) const override; bool find_not_null_fields(table_map allowed) override { return false; } + SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) override; Item *do_get_copy(THD *thd) const override { return get_item_copy(thd, this); } bool eval_not_null_tables(void *) override diff --git a/sql/opt_range.cc b/sql/opt_range.cc index a3b3b292009..bc8519cd7f6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8150,6 +8150,46 @@ SEL_TREE *Item_func_ne::get_func_mm_tree(RANGE_OPT_PARAM *param, } +SEL_TREE *Item_func_istrue::get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) +{ + DBUG_ENTER("Item_func_istrue::get_func_mm_tree"); + // See comments in Item_func_ne::get_func_mm_tree() + if (param->using_real_indexes && is_field_an_unique_index(field)) + DBUG_RETURN(NULL); + DBUG_RETURN(get_ne_mm_tree(param, field, value, value)); +} + + +SEL_TREE *Item_func_isnotfalse::get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, Item *value) +{ + DBUG_ENTER("Item_func_notfalse::get_func_mm_tree"); + // See comments in Item_func_ne::get_func_mm_tree() + if (param->using_real_indexes && is_field_an_unique_index(field)) + DBUG_RETURN(NULL); + DBUG_RETURN(get_ne_mm_tree(param, field, value, value)); +} + + +SEL_TREE *Item_func_isfalse::get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, + Item *value) +{ + DBUG_ENTER("Item_bool_isfalse::get_func_mm_tree"); + DBUG_RETURN(get_mm_parts(param, field, EQ_FUNC, value)); +} + + +SEL_TREE *Item_func_isnottrue::get_func_mm_tree(RANGE_OPT_PARAM *param, + Field *field, + Item *value) +{ + DBUG_ENTER("Item_func_isnottrue::get_func_mm_tree"); + DBUG_RETURN(get_mm_parts(param, field, EQ_FUNC, value)); +} + + SEL_TREE *Item_func_between::get_func_mm_tree(RANGE_OPT_PARAM *param, Field *field, Item *value) { @@ -8926,6 +8966,38 @@ SEL_TREE *Item_func_in::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) } +SEL_TREE *Item_func_truth::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) +{ + DBUG_ENTER("Item_func_truth::get_mm_tree"); + DBUG_ASSERT(arg_count == 1); + MEM_ROOT *old_root= param->thd->mem_root; + param->thd->mem_root= param->old_root; + Item *tmp= args[0]->type_handler()->create_boolean_false_item(param->thd); + param->thd->mem_root= old_root; + + SEL_TREE *ftree= get_full_func_mm_tree_for_args(param, args[0], tmp); + if (!ftree) + goto err; + if (!affirmative) // x IS NOT {TRUE|FALSE} + { + /* + A non-affirmative boolean test works as follows: + - NULL IS NOT FALSE returns TRUE + - NULL IS NOT TRUE returns TRUE + Let's add the "x IS NULL" tree: + */ + SEL_TREE *ftree2= get_full_func_mm_tree_for_args(param, args[0], NULL); + if (!ftree2) + goto err; + ftree= tree_or(param, ftree, ftree2); + } +err: + if (!ftree) + ftree= Item_func::get_mm_tree(param, cond_ptr); + DBUG_RETURN(ftree); +} + + SEL_TREE *Item_equal::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) { DBUG_ENTER("Item_equal::get_mm_tree"); @@ -9294,6 +9366,28 @@ Item_func_null_predicate::get_mm_leaf(RANGE_OPT_PARAM *param, } +SEL_ARG * +Item_func_truth::get_mm_leaf(RANGE_OPT_PARAM *param, + Field *field, KEY_PART *key_part, + Item_func::Functype type, + Item *value) +{ + MEM_ROOT *alloc= param->mem_root; + DBUG_ENTER("Item_func_truth::get_mm_leaf"); + if (value) // Affirmative: x IS {FALSE|TRUE} + DBUG_RETURN(Item_bool_func::get_mm_leaf(param, field, key_part, + type, value)); + DBUG_ASSERT(!affirmative); // x IS NOT {FALSE|TRUE} + /* + No check for field->table->maybe_null. + See comments in Item_func_null_predicate::get_mm_leaf() + */ + if (!field->real_maybe_null()) + DBUG_RETURN(&null_element); + DBUG_RETURN(new (alloc) SEL_ARG(field, is_null_string, is_null_string)); +} + + SEL_ARG * Item_func_like::get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 62acd758699..7513e3e5b8f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8944,7 +8944,7 @@ Item *normalize_cond(THD *thd, Item *cond) { item_base_t is_cond_flag= cond->base_flags & item_base_t::IS_COND; cond->base_flags&= ~item_base_t::IS_COND; - cond= new (thd->mem_root) Item_func_ne(thd, cond, new (thd->mem_root) Item_int(thd, 0)); + cond= new (thd->mem_root) Item_func_istrue(thd, cond); if (cond) cond->base_flags|= is_cond_flag; } @@ -8958,8 +8958,7 @@ Item *normalize_cond(THD *thd, Item *cond) Item *arg= func_item->arguments()[0]; if (arg->type() == Item::FIELD_ITEM || arg->type() == Item::REF_ITEM) - cond= new (thd->mem_root) Item_func_eq(thd, arg, - new (thd->mem_root) Item_int(thd, 0)); + cond= new (thd->mem_root) Item_func_isfalse(thd, arg); } } } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c881957c118..b129e97ba2c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7118,6 +7118,26 @@ Item_bool_func2::add_key_fields_optimize_op(JOIN *join, KEY_FIELD **key_fields, } +void +Item_func_truth::add_key_fields(JOIN *join, + KEY_FIELD **key_fields, + uint *and_level, + table_map usable_tables, + SARGABLE_PARAM **sargables) +{ + if (is_local_field(args[0])) + { + Item *tmp= args[0]->type_handler()->create_boolean_false_item(join->thd); + if (unlikely(!tmp)) + return; + add_key_equal_fields(join, key_fields, *and_level, this, + (Item_field*) args[0]->real_item(), + false/*equal_func*/, + &tmp, 1, usable_tables, sargables); + } +} + + void Item_func_null_predicate::add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 2c0d2b4bf25..cdff220c790 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -5258,7 +5258,7 @@ bool Type_handler_temporal_result::Item_val_bool(Item *item) const bool Type_handler_string_result::Item_val_bool(Item *item) const { - return item->val_real() != 0.0; + return item->val_bool_from_str(); } @@ -8162,6 +8162,12 @@ Item *Type_handler_interval_DDhhmmssff:: attr.decimals()); } +/***************************************************************************/ +Item_literal *Type_handler::create_boolean_false_item(THD *thd) const +{ + return new (thd->mem_root) Item_int(thd, 0); +} + /***************************************************************************/ void Type_handler_string_result::Item_param_setup_conversion(THD *thd, diff --git a/sql/sql_type.h b/sql/sql_type.h index 829bf4f2245..195921a5e27 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -4458,6 +4458,18 @@ public: { return NULL; } + + /** + normalize_cond() replaces + `WHERE table_column` to + `WHERE table_column IS TRUE` + This method creates a literal Item corresponding to FALSE. + For example: + - for numeric data types it returns Item_int(0) + - for INET6 it returns Item_literal_fbt('::') + */ + virtual Item_literal *create_boolean_false_item(THD *thd) const; + /** A builder for literals with data type name prefix, e.g.: TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'. diff --git a/sql/sql_type_fixedbin.h b/sql/sql_type_fixedbin.h index 283cd1dc73e..c1a1567c03b 100644 --- a/sql/sql_type_fixedbin.h +++ b/sql/sql_type_fixedbin.h @@ -1895,6 +1895,11 @@ public: return Item_func_or_sum_illegal_param(item); } + Item_literal *create_boolean_false_item(THD *thd) const override + { + return new (thd->mem_root) Item_literal_fbt(thd); + } + static Type_handler_fbt *singleton() { static Type_handler_fbt th;