File: deprecated_features.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (433 lines) | stat: -rw-r--r-- 12,313 bytes parent folder | download
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
--error ER_UNKNOWN_SYSTEM_VARIABLE
set global log_bin_trust_routine_creators=1;
--error ER_UNKNOWN_SYSTEM_VARIABLE
set table_type='MyISAM';
--error ER_UNKNOWN_SYSTEM_VARIABLE
select @@table_type='MyISAM';
--error ER_PARSE_ERROR
backup table t1 to 'data.txt';
--error ER_PARSE_ERROR
restore table t1 from 'data.txt';
--error ER_PARSE_ERROR
show plugin;
--error ER_PARSE_ERROR
load table t1 from master;
--error ER_PARSE_ERROR
load data from master;
--error ER_PARSE_ERROR
SHOW INNODB STATUS;
--error ER_PARSE_ERROR
create table t1 (t6 timestamp) type=myisam;
--error ER_PARSE_ERROR
show table types;
--error ER_PARSE_ERROR
show mutex status;

--echo # WL#13070 Deprecate && as synonym for AND and || as synonym for OR in SQL statements
# Verify that || sends no warning if PIPES_AS_CONCAT

set sql_mode=pipes_as_concat;
select 2 || 3;
select 2 or 3;
select concat(2,3);
set sql_mode='';
select 2 || 3;
select 2 or 3;
set sql_mode=default;

--echo # WL#13068 Deprecate BINARY keyword for specifying _bin collations

--echo # (I) Those statements SHOULD WARN

# CREATE TABLE for column
create table t1 (v varchar(10) binary);
show create table t1;
drop table t1;
# "binary" after "character set" is one yacc rule:
create table t1 (v varchar(10) character set latin1 binary);
show create table t1;
drop table t1;
# and the reverse order is another rule:
create table t1 (v varchar(10) binary character set latin1);
show create table t1;
drop table t1;

# ASCII and UNICODE have dedicated yacc rules
create table t1 (v varchar(10) binary ascii);
show create table t1;
drop table t1;
create table t1 (v varchar(10) ascii binary);
show create table t1;
drop table t1;
create table t1 (v varchar(10) binary unicode);
show create table t1;
drop table t1;
create table t1 (v varchar(10) unicode binary);
show create table t1;
drop table t1;

# ALTER TABLE for column
create table t1 (v varchar(10));
show create table t1;
alter table t1 modify v varchar(10) binary character set latin1;
show create table t1;
alter table t1 modify v varchar(10) unicode binary;
show create table t1;
alter table t1 modify v varchar(10) binary ascii;
show create table t1;
drop table t1;

select collation(cast('a' as char(2))), collation(cast('a' as char(2) binary));
select collation(convert('a', char(2))), collation(convert('a', char(2) binary));
select collation(convert('a',char(2) ascii)), collation(convert('a',char(2) ascii binary));

--echo # (II) Those statements SHOULDN'T WARN, as they do make
--echo # "binary" charset, not just a "_bin" collation of another charset.

# A binary column:

create table t1 (v binary(10));
show create table t1;
drop table t1;

# table's charset:

create table t1 (v varchar(10)) character set binary;
show create table t1;
drop table t1;

create table t1 (v varchar(10));
show create table t1;
alter table t1 character set binary;
show create table t1;
drop table t1;

# database's charset:

create database mysqltest2 default character set = binary;
show create database mysqltest2 ;
drop database mysqltest2;
create database mysqltest2 default character set = latin1;
show create database mysqltest2 ;
alter database mysqltest2 default character set = binary;
show create database mysqltest2 ;
drop database mysqltest2;

# session variables:

select @@character_set_client;
set character set binary;
select @@character_set_client;
set character set default;
select @@character_set_client;
set names binary;
select @@character_set_client;
set names default;

# misc:

# gives binary charset
select convert("123" using binary);
select char(123 using binary);
select collation(char(123)), collation(char(123 using binary));

# creates varbinary
create table t1 (v varchar(10) byte);
show create table t1;

# LOAD DATA INFILE '$file' :
# and SELECT ... INTO OUTFILE:

# https://dev.mysql.com/doc/refman/8.0/en/load-data.html says:
# "If the contents of the input file use a character set that differs
# from the default, it is usually preferable to specify the character set
# of the file by using the CHARACTER SET clause. A character set of
# binary specifies "no conversion.""
# So it's not about implying a _bin collation of another charset:
# no warning.

insert into t1 values("xyz");
select * from t1 into outfile 'tmp1.txt' character set binary;
load data infile 'tmp1.txt' into table t1 character set binary;
select * from t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmp1.txt;
drop table t1;

--echo
--echo # WL#13588 Deprecate support for prefix keys in partition functions.
--echo

CREATE SCHEMA testdb;

--echo
--echo # Should show deprecation warnings on CREATE TABLE for affected tables.

--echo
CREATE TABLE testdb.t1 (
    a VARCHAR (10000),
    b VARCHAR (25),
    c VARCHAR (10),
    PRIMARY KEY (a(10),b,c(2))
) PARTITION BY KEY() PARTITIONS 2;

--echo
CREATE TABLE testdb.t2 (
    a VARCHAR (200),
    b VARCHAR (10),
    PRIMARY KEY (a(2),b)
) PARTITION BY KEY() PARTITIONS 2;

--echo
CREATE TABLE testdb.t3 (
    a VARCHAR (200),
    b VARCHAR (10),
    PRIMARY KEY (a(2),b)
) PARTITION BY KEY() PARTITIONS 10;

--echo
--echo # Should not show deprecation warnings if prefix key is not used
--echo # in the PARTITION BY KEY() clause.
CREATE TABLE testdb.t4 (
    a VARCHAR (200),
    b VARCHAR (10),
    c VARCHAR (100),
    KEY (a),
    KEY (b(5))
) PARTITION BY KEY(c) PARTITIONS 10;

--echo
--echo # Should not show deprecation warnings for CREATE TABLE LIKE.
CREATE TABLE testdb.l1 LIKE testdb.t1;

--echo
--echo # Should show deprecation warnings for ALTER TABLE on affected tables.

--echo
ALTER TABLE testdb.t1 COMMENT='t1';

--echo
--echo # Should show deprecation warnings if a table having prefix keys is
--echo # altered to be partitioned by key.
CREATE TABLE testdb.t5 (
    a VARCHAR (10000),
    b VARCHAR (25),
    c VARCHAR (10),
    PRIMARY KEY (a(10),b,c(2))
);
ALTER TABLE testdb.t5 PARTITION BY KEY() PARTITIONS 10;

--echo
--echo # Should not show deprecation warnings on removing partitioning from an
--echo # affected table.
ALTER TABLE testdb.t5 REMOVE PARTITIONING;

--echo
--echo # Should not show deprecation warning if prefix length = column length.
CREATE TABLE testdb.t6 (
    a VARCHAR (200),
    b VARCHAR (10),
    PRIMARY KEY (a(200),b)
) PARTITION BY KEY() PARTITIONS 10;

--echo
--echo # Should not show deprecation warnings for RENAME TABLE.
RENAME TABLE testdb.t1 TO testdb.t1_renamed;

--echo
--echo # Should show deprecation warnings if prefix key is used in the
--echo # PARTITION BY KEY() clause, regardless of lettercase.
CREATE TABLE testdb.t7 (
    a VARCHAR (200),
    b VARCHAR (10),
    c VARCHAR (100),
    KEY (a),
    KEY (b(5))
) PARTITION BY KEY(B) PARTITIONS 2;

--echo
CREATE TABLE testdb.t8 (
    A VARCHAR (200),
    B VARCHAR (10),
    C VARCHAR (100),
    KEY (A),
    KEY (B(5))
) PARTITION BY KEY(b) PARTITIONS 2;

--echo
--echo # Should not show deprecation warnings when there is no index.
CREATE TABLE testdb.m1 (
    firstname VARCHAR (25) NOT NULL,
    lastname VARCHAR (25) NOT NULL,
    username VARCHAR (16) NOT NULL,
    email VARCHAR (35),
    joined DATE NOT NULL
) PARTITION BY KEY(joined) PARTITIONS 6;

--echo
--echo # Should not show deprecation warnings for table partitioned by range.
CREATE TABLE testdb.m2 (
    firstname VARCHAR (25) NOT NULL,
    lastname VARCHAR (25) NOT NULL,
    username VARCHAR (16) NOT NULL,
    email VARCHAR (35),
    joined DATE NOT NULL
) PARTITION BY RANGE(YEAR(joined)) (
    PARTITION p0 VALUES LESS THAN (1960),
    PARTITION p1 VALUES LESS THAN (1970),
    PARTITION p2 VALUES LESS THAN (1980),
    PARTITION p3 VALUES LESS THAN (1990),
    PARTITION p4 VALUES LESS THAN MAXVALUE
);

--echo
--echo # Should not show deprecation warnings for table with a prefix key
--echo # partitioned by range
CREATE TABLE testdb.m3 (
    firstname VARCHAR (25) NOT NULL,
    lastname VARCHAR (25) NOT NULL,
    username VARCHAR (16) NOT NULL,
    email VARCHAR (35),
    joined DATE NOT NULL,
    PRIMARY KEY(firstname(5),joined)
) PARTITION BY RANGE(YEAR(joined)) (
    PARTITION p0 VALUES LESS THAN (1960),
    PARTITION p1 VALUES LESS THAN (1970),
    PARTITION p2 VALUES LESS THAN (1980),
    PARTITION p3 VALUES LESS THAN (1990),
    PARTITION p4 VALUES LESS THAN MAXVALUE
);

--echo
--echo # Should show deprecation warnings for combinations of column type
--echo # CHAR|VARCHAR|BINARY|VARBINARY, [LINEAR] KEY, and ALGORITHM=1|2

--echo
CREATE TABLE testdb.t_char_linear_alg1 (
    prefix_col CHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varchar_linear_alg1 (
    prefix_col VARCHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_binary_linear_alg1 (
    prefix_col BINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varbinary_linear_alg1 (
    prefix_col VARBINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_char_nonlinear_alg1 (
    prefix_col CHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varchar_nonlinear_alg1 (
    prefix_col VARCHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_binary_nonlinear_alg1 (
    prefix_col BINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varbinary_nonlinear_alg1 (
    prefix_col VARBINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=1 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_char_linear_alg2 (
    prefix_col CHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varchar_linear_alg2 (
    prefix_col VARCHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_binary_linear_alg2 (
    prefix_col BINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varbinary_linear_alg2 (
    prefix_col VARBINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY LINEAR KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_char_nonlinear_alg2 (
    prefix_col CHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varchar_nonlinear_alg2 (
    prefix_col VARCHAR (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_binary_nonlinear_alg2 (
    prefix_col BINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=2 () PARTITIONS 3;

--echo
CREATE TABLE testdb.t_varbinary_nonlinear_alg2 (
    prefix_col VARBINARY (100),
    other_col VARCHAR (5),
    PRIMARY KEY (prefix_col(10), other_col)
) PARTITION BY KEY ALGORITHM=2 () PARTITIONS 3;

--echo
--echo # Cleanup.

--echo
DROP SCHEMA testdb;


--echo
--echo # WL#14064 Deprecate INFORMATION_SCHEMA.TABLESPACES
--echo
--echo # Should show a deprecation warning in all cases.
SELECT * FROM INFORMATION_SCHEMA.TABLESPACES;
SELECT * FROM INFORMATION_SCHEMA.tablespaces;
--skip_if_hypergraph  # The warning is repeated a different amount of times.
SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.TABLESPACES;
--skip_if_hypergraph  # The warning is repeated a different amount of times.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLESPACES);