summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/range.result12
-rw-r--r--mysql-test/t/range.test9
-rw-r--r--sql/opt_range.cc2
3 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 1b984666462..a7fb28c988a 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -2263,5 +2263,17 @@ a b
70 NULL
DROP TABLE t1;
#
+# MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
+EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1
+DROP TABLE t1;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index d65e0bb2f73..9ce050c2da3 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1796,5 +1796,14 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
+EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index d0b66c6189b..af50fb8a49b 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7845,7 +7845,7 @@ Item_bool_func::get_mm_leaf(RANGE_OPT_PARAM *param,
err= value->save_in_field_no_warnings(field, 1);
if (err == 2 && field->cmp_type() == STRING_RESULT)
{
- if (type == EQ_FUNC)
+ if (type == EQ_FUNC || type == EQUAL_FUNC)
{
tree= new (alloc) SEL_ARG(field, 0, 0);
tree->type= SEL_ARG::IMPOSSIBLE;