Skip to content

Commit ab9f378

Browse files
author
Varun Gupta
committed
Backporting 273d8eb Proper fix for disabling warnings in read_statistics_for_table()
1 parent 2931fd2 commit ab9f378

12 files changed

+85
-186
lines changed

mysql-test/include/ctype_utf8_ilseq.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ SHOW CREATE TABLE t1;
1414

1515
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
1616
SELECT ch FROM t1 WHERE ch='admin𝌆';
17+
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
1718
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
1819
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
1920
DELETE FROM t1;

mysql-test/r/compare.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,23 @@ CREATE TABLE t1(a INT ZEROFILL);
100100
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
101101
1
102102
DROP TABLE t1;
103+
CREATE TABLE t1 (a char(2), index (a));
104+
insert into t1 values ("aa"),("bb");
105+
select * from t1 where a="aa";
106+
a
107+
aa
108+
select * from t1 where a="aaa";
109+
a
110+
select * from t1 where a="aa ";
111+
a
112+
aa
113+
select * from t1 where a>="aaa";
114+
a
115+
bb
116+
explain select * from t1 where a="aaa";
117+
id select_type table type possible_keys key key_len ref rows Extra
118+
1 SIMPLE t1 ref a a 3 const 1 Using where; Using index
119+
explain select * from t1 where a="aa ";
120+
id select_type table type possible_keys key key_len ref rows Extra
121+
1 SIMPLE t1 ref a a 3 const 1 Using where; Using index
122+
drop table t1;

mysql-test/r/ctype_uca.result

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6748,14 +6748,13 @@ t1 CREATE TABLE `t1` (
67486748
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
67496749
SELECT ch FROM t1 WHERE ch='admin𝌆';
67506750
ch
6751-
Warnings:
6752-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
6751+
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
6752+
id select_type table type possible_keys key key_len ref rows Extra
6753+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
67536754
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
67546755
ch
67556756
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
67566757
ch
6757-
Warnings:
6758-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
67596758
DELETE FROM t1;
67606759
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
67616760
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -6771,22 +6770,14 @@ EXPLAIN
67716770
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
67726771
id select_type table type possible_keys key key_len ref rows Extra
67736772
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
6774-
Warnings:
6775-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
67766773
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
67776774
ch
6778-
Warnings:
6779-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
67806775
EXPLAIN
67816776
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
67826777
id select_type table type possible_keys key key_len ref rows Extra
67836778
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
6784-
Warnings:
6785-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
67866779
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
67876780
ch
6788-
Warnings:
6789-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
67906781
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
67916782
ch
67926783
a
@@ -6829,8 +6820,6 @@ EXPLAIN
68296820
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
68306821
id select_type table type possible_keys key key_len ref rows Extra
68316822
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
6832-
Warnings:
6833-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
68346823
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
68356824
ch
68366825
a
@@ -6850,14 +6839,10 @@ ab
68506839
az
68516840
68526841
6853-
Warnings:
6854-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
68556842
EXPLAIN
68566843
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
68576844
id select_type table type possible_keys key key_len ref rows Extra
68586845
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
6859-
Warnings:
6860-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
68616846
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
68626847
ch
68636848
a
@@ -6877,8 +6862,6 @@ ab
68776862
az
68786863
68796864
6880-
Warnings:
6881-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
68826865
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
68836866
ch
68846867
z
@@ -6889,24 +6872,16 @@ EXPLAIN
68896872
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
68906873
id select_type table type possible_keys key key_len ref rows Extra
68916874
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
6892-
Warnings:
6893-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
68946875
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
68956876
ch
68966877
z
6897-
Warnings:
6898-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
68996878
EXPLAIN
69006879
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
69016880
id select_type table type possible_keys key key_len ref rows Extra
69026881
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
6903-
Warnings:
6904-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
69056882
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
69066883
ch
69076884
z
6908-
Warnings:
6909-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
69106885
ALTER TABLE t1 DROP KEY ch;
69116886
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
69126887
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');
@@ -6992,14 +6967,13 @@ t1 CREATE TABLE `t1` (
69926967
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
69936968
SELECT ch FROM t1 WHERE ch='admin𝌆';
69946969
ch
6995-
Warnings:
6996-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
6970+
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
6971+
id select_type table type possible_keys key key_len ref rows Extra
6972+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
69976973
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
69986974
ch
69996975
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
70006976
ch
7001-
Warnings:
7002-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
70036977
DELETE FROM t1;
70046978
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
70056979
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -7015,22 +6989,14 @@ EXPLAIN
70156989
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
70166990
id select_type table type possible_keys key key_len ref rows Extra
70176991
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
7018-
Warnings:
7019-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
70206992
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
70216993
ch
7022-
Warnings:
7023-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
70246994
EXPLAIN
70256995
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
70266996
id select_type table type possible_keys key key_len ref rows Extra
70276997
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
7028-
Warnings:
7029-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
70306998
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
70316999
ch
7032-
Warnings:
7033-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
70347000
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
70357001
ch
70367002
a

mysql-test/r/ctype_uca_innodb.result

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ t1 CREATE TABLE `t1` (
2323
INSERT INTO t1 (ch) VALUES ('admin'),('admin1');
2424
SELECT ch FROM t1 WHERE ch='admin𝌆';
2525
ch
26-
Warnings:
27-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
26+
EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆';
27+
id select_type table type possible_keys key key_len ref rows Extra
28+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2829
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆';
2930
ch
3031
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆';
3132
ch
32-
Warnings:
33-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
3433
DELETE FROM t1;
3534
INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????');
3635
INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b');
@@ -46,22 +45,14 @@ EXPLAIN
4645
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
4746
id select_type table type possible_keys key key_len ref rows Extra
4847
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
49-
Warnings:
50-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
5148
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch;
5249
ch
53-
Warnings:
54-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
5550
EXPLAIN
5651
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
5752
id select_type table type possible_keys key key_len ref rows Extra
5853
1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables
59-
Warnings:
60-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
6154
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch;
6255
ch
63-
Warnings:
64-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
6556
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
6657
ch
6758
a
@@ -104,8 +95,6 @@ EXPLAIN
10495
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
10596
id select_type table type possible_keys key key_len ref rows Extra
10697
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
107-
Warnings:
108-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
10998
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch;
11099
ch
111100
a
@@ -125,14 +114,10 @@ ab
125114
az
126115
127116
128-
Warnings:
129-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
130117
EXPLAIN
131118
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
132119
id select_type table type possible_keys key key_len ref rows Extra
133120
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
134-
Warnings:
135-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
136121
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch;
137122
ch
138123
a
@@ -152,8 +137,6 @@ ab
152137
az
153138
154139
155-
Warnings:
156-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
157140
SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
158141
ch
159142
z
@@ -164,24 +147,16 @@ EXPLAIN
164147
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
165148
id select_type table type possible_keys key key_len ref rows Extra
166149
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
167-
Warnings:
168-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
169150
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch;
170151
ch
171152
z
172-
Warnings:
173-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1
174153
EXPLAIN
175154
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
176155
id select_type table type possible_keys key key_len ref rows Extra
177156
1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
178-
Warnings:
179-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
180157
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch;
181158
ch
182159
z
183-
Warnings:
184-
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1
185160
ALTER TABLE t1 DROP KEY ch;
186161
# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence
187162
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'''');

0 commit comments

Comments
 (0)