summaryrefslogtreecommitdiff
path: root/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result
blob: f2a1e27d0d033ff9ee686c85604008d33ae95aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#
# Start of 10.5 tests
#
#
# MDEV-4958 Adding datatype UUID
#
SET default_storage_engine=MEMORY;
#
# Range optimizer
#
CREATE TABLE t1 (a UUID, INDEX(a));
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` uuid DEFAULT NULL,
  KEY `a` (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
FOR i IN 0..255
DO
INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY)));
END FOR
$$
SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
a
00000000-0000-0000-0000-0000000000ff
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	4	Using where
SELECT * FROM t1 WHERE a='garbage';
a
Warnings:
Warning	1292	Incorrect uuid value: 'garbage'
EXPLAIN SELECT * FROM t1 WHERE a='garbage';
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	1292	Incorrect uuid value: 'garbage'
SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
a
00000000-0000-0000-0000-0000000000fe
00000000-0000-0000-0000-0000000000ff
EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	256	Using where
SELECT * FROM t1 WHERE a>='garbage';
a
Warnings:
Warning	1292	Incorrect uuid value: 'garbage'
EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	256	Using where
SELECT * FROM t1 WHERE a IN
(
'00000000-0000-0000-0000-000000000080',
'00000000-0000-0000-0000-0000000000a0',
'00000000-0000-0000-0000-0000000000f0'
);
a
00000000-0000-0000-0000-000000000080
00000000-0000-0000-0000-0000000000a0
00000000-0000-0000-0000-0000000000f0
EXPLAIN SELECT * FROM t1 WHERE a IN
(
'00000000-0000-0000-0000-000000000080',
'00000000-0000-0000-0000-0000000000a0',
'00000000-0000-0000-0000-0000000000f0'
);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	a	a	17	NULL	12	Using where
SELECT * FROM t1 WHERE a IN
(
'00000000-0000-0000-0000-000000000080',
'00000000-0000-0000-0000-0000000000a0',
'garbage'
);
a
00000000-0000-0000-0000-000000000080
00000000-0000-0000-0000-0000000000a0
Warnings:
Warning	1292	Incorrect uuid value: 'garbage'
EXPLAIN SELECT * FROM t1 WHERE a IN
(
'00000000-0000-0000-0000-000000000080',
'00000000-0000-0000-0000-0000000000a0',
'garbage'
);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	a	a	17	NULL	8	Using where
Warnings:
Warning	1292	Incorrect uuid value: 'garbage'
SELECT * FROM t1 WHERE a BETWEEN
'00000000-0000-0000-0000-000000000080' AND
'00000000-0000-0000-0000-000000000081';
a
00000000-0000-0000-0000-000000000080
00000000-0000-0000-0000-000000000081
EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
'00000000-0000-0000-0000-000000000080' AND
'00000000-0000-0000-0000-000000000081';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	256	Using where
SELECT * FROM t1 WHERE a BETWEEN
'00000000-0000-0000-0000-000000000080' AND
'garbage';
a
Warnings:
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
Warning	1292	Incorrect uuid value: 'garbage'
EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
'00000000-0000-0000-0000-000000000080' AND
'garbage';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	256	Using where
SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
a
00000000-0000-0000-0000-0000000000ff
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	a	a	17	const	4	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff'
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a UUID,KEY(a));
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` uuid DEFAULT NULL,
  KEY `a` (`a`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
BEGIN;
FOR i IN 0..255
DO
INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
END FOR;
$$
COMMIT;
EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a	a	17	const	2	Using where
DROP TABLE t1;
#
# End of 10.5 tests
#