summaryrefslogtreecommitdiff
path: root/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result
blob: 9c61cfb117187e70a93a057e712bb46244081e1f (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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#
# Start of 10.7 tests
#
#
# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
#
CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0);
# Start of type_store_assignment_incompatible.inc
SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME='source'
                   AND TABLE_NAME='t1'
                   AND TABLE_SCHEMA='test');
SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME='target'
                   AND TABLE_NAME='t1'
                   AND TABLE_SCHEMA='test');
CREATE TABLE t2 LIKE t1;
ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `id` int(11) NOT NULL,
  `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
  `source` int(10) unsigned DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t3 LIKE t2;
INSERT INTO t3 VALUES
(1,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP TABLE t3;
SET sql_mode='';
CREATE TABLE t3 LIKE t2;
ALTER TABLE t3 ENGINE=MyISAM;
EXECUTE IMMEDIATE
CONCAT('CREATE VIEW v3 AS SELECT id,',
IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
' FROM t3');
INSERT INTO t3 VALUES
(1,
(SELECT target FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1)),
(2,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
Warnings:
Warning	1292	Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
SELECT * FROM v3;
id	target	source
1	00000000-0000-0000-0000-000000000000	0
2	00000000-0000-0000-0000-000000000000	0
TRUNCATE TABLE t3;
SET sql_mode=STRICT_ALL_TABLES;
INSERT INTO t3 VALUES
(1,
(SELECT target FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1)),
(2,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
Got one of the listed errors
SELECT * FROM v3;
id	target	source
1	00000000-0000-0000-0000-000000000000	0
TRUNCATE TABLE t3;
SET sql_mode=DEFAULT;
DROP TABLE t3;
DROP VIEW v3;
CREATE TABLE t3 LIKE t2;
INSERT INTO t3 SELECT id,source,source FROM t2;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
UPDATE t3 SET target=source;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type);
SELECT @alter;
@alter
ALTER TABLE t3 MODIFY target int(10) unsigned
EXECUTE IMMEDIATE @alter;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP TABLE t3;
DROP TABLE t2;
CREATE PROCEDURE p1()
BEGIN
DECLARE src int(10) unsigned DEFAULT NULL;
DECLARE dst uuid DEFAULT NULL;
SET dst=src;
END;
$$
CALL p1;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP PROCEDURE p1;
CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP FUNCTION f1;
CREATE PROCEDURE p1(a uuid) BEGIN END;;
CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP PROCEDURE p1;
CREATE PROCEDURE p1(OUT dst uuid)
BEGIN
DECLARE src int(10) unsigned DEFAULT NULL;
SET dst=src;
END;
$$
CREATE PROCEDURE p2()
BEGIN
DECLARE dst uuid DEFAULT NULL;
CALL p1(dst);
END;
$$
CALL p2();
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
SHOW WARNINGS;
Level	Code	Message
Error	4078	Illegal parameter data types uuid and int unsigned for operation 'SET'
Note	4094	At line 4 in test.p1
Note	4094	At line 4 in test.p2
DROP PROCEDURE p2;
DROP PROCEDURE p1;
CREATE FUNCTION f1() RETURNS uuid
BEGIN
DECLARE rc int(10) unsigned DEFAULT NULL;
RETURN rc;
END;
$$
SELECT f1();
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP FUNCTION f1;
CREATE PROCEDURE p1()
BEGIN
DECLARE src int(10) unsigned DEFAULT NULL;
DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
OPEN cur1(src);
CLOSE cur1;
END;
$$
CALL p1();
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP PROCEDURE p1;
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 VALUES ();
CREATE PROCEDURE p1()
BEGIN
DECLARE dst uuid DEFAULT NULL;
DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
OPEN cur2;
FETCH cur2 INTO dst;
CLOSE cur2;
END;
$$
CALL p1();
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP PROCEDURE p1;
DROP TABLE t2;
# End of type_store_assignment_incompatible.inc
DROP TABLE t1;
CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
# Start of type_store_assignment_incompatible.inc
SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME='source'
                   AND TABLE_NAME='t1'
                   AND TABLE_SCHEMA='test');
SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME='target'
                   AND TABLE_NAME='t1'
                   AND TABLE_SCHEMA='test');
CREATE TABLE t2 LIKE t1;
ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `id` int(11) NOT NULL,
  `target` int(10) unsigned DEFAULT 0,
  `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t3 LIKE t2;
INSERT INTO t3 VALUES
(1,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP TABLE t3;
SET sql_mode='';
CREATE TABLE t3 LIKE t2;
ALTER TABLE t3 ENGINE=MyISAM;
EXECUTE IMMEDIATE
CONCAT('CREATE VIEW v3 AS SELECT id,',
IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
' FROM t3');
INSERT INTO t3 VALUES
(1,
(SELECT target FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1)),
(2,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
Warnings:
Warning	1265	Data truncated for column 'target' at row 2
SELECT * FROM v3;
id	target	source
1	0	00000000-0000-0000-0000-000000000000
2	0	00000000-0000-0000-0000-000000000000
TRUNCATE TABLE t3;
SET sql_mode=STRICT_ALL_TABLES;
INSERT INTO t3 VALUES
(1,
(SELECT target FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1)),
(2,
(SELECT source FROM t2 ORDER BY id LIMIT 1),
(SELECT source FROM t2 ORDER BY id LIMIT 1));
Got one of the listed errors
SELECT * FROM v3;
id	target	source
1	0	00000000-0000-0000-0000-000000000000
TRUNCATE TABLE t3;
SET sql_mode=DEFAULT;
DROP TABLE t3;
DROP VIEW v3;
CREATE TABLE t3 LIKE t2;
INSERT INTO t3 SELECT id,source,source FROM t2;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
UPDATE t3 SET target=source;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type);
SELECT @alter;
@alter
ALTER TABLE t3 MODIFY target uuid
EXECUTE IMMEDIATE @alter;
ERROR HY000: Illegal parameter data types uuid and int unsigned for operation 'SET'
DROP TABLE t3;
DROP TABLE t2;
CREATE PROCEDURE p1()
BEGIN
DECLARE src uuid DEFAULT NULL;
DECLARE dst int(10) unsigned DEFAULT NULL;
SET dst=src;
END;
$$
CALL p1;
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP PROCEDURE p1;
CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;;
SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP FUNCTION f1;
CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;;
CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP PROCEDURE p1;
CREATE PROCEDURE p1(OUT dst int(10) unsigned)
BEGIN
DECLARE src uuid DEFAULT NULL;
SET dst=src;
END;
$$
CREATE PROCEDURE p2()
BEGIN
DECLARE dst int(10) unsigned DEFAULT NULL;
CALL p1(dst);
END;
$$
CALL p2();
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
SHOW WARNINGS;
Level	Code	Message
Error	4078	Illegal parameter data types int unsigned and uuid for operation 'SET'
Note	4094	At line 4 in test.p1
Note	4094	At line 4 in test.p2
DROP PROCEDURE p2;
DROP PROCEDURE p1;
CREATE FUNCTION f1() RETURNS int(10) unsigned
BEGIN
DECLARE rc uuid DEFAULT NULL;
RETURN rc;
END;
$$
SELECT f1();
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP FUNCTION f1;
CREATE PROCEDURE p1()
BEGIN
DECLARE src uuid DEFAULT NULL;
DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t;
OPEN cur1(src);
CLOSE cur1;
END;
$$
CALL p1();
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP PROCEDURE p1;
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 VALUES ();
CREATE PROCEDURE p1()
BEGIN
DECLARE dst int(10) unsigned DEFAULT NULL;
DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
OPEN cur2;
FETCH cur2 INTO dst;
CLOSE cur2;
END;
$$
CALL p1();
ERROR HY000: Illegal parameter data types int unsigned and uuid for operation 'SET'
DROP PROCEDURE p1;
DROP TABLE t2;
# End of type_store_assignment_incompatible.inc
DROP TABLE t1;
#
# End of 10.7 tests
#