Debian Codegraph @

mysql-test/suite/encryption/r/alter_rename_table.result

raw
1 #
2 # WL#12261 Control (enforce and disable) table encryption
3 #
4 # Pre-define user u1, which is used in different tests below.
5 CREATE USER u1@localhost;
6 GRANT ALL ON db1.* TO u1@localhost;
7 GRANT ALL ON db2.* TO u1@localhost;
8 GRANT ALL ON sch1.* TO u1@localhost;
9 GRANT ALL ON sch2.* TO u1@localhost;
10 GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost;
11 SET GLOBAL debug= '+d,skip_table_encryption_admin_check_for_set';
12 # The test cases run ALTER TABLE RENAME to move tables from one database
13 # to another, with tables using file-per-table or general
14 # tablespace. And these operations are run in below configuration,
15 #
16 # - Setting table_encryption_privilege_check to true/false.
17 # - Setting per database default encryption to 'y' and 'n'
18 # - Setting table's encryption mode to 'y' and 'n'.
19 # - With and without user holding TABLE_ENCRYPTION_ADMIN privilege.
20 # -
21 # - Check for warnings generated.
22 #
23 `````````````````````````````````````````````````````````
24 # Test using innodb_file_per_table tablespace.
25 `````````````````````````````````````````````````````````
26 # table_encryption_privilege_check=false
27 # [ALTER TABLE ... RENAME ...] Case 1 )
28 `````````````````````````````````````````````````````````
29 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
30 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
31 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
32 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
33 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
34 Warnings:
35 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
36 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
37 Warnings:
38 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
39 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
40 Warnings:
41 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
42 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
43 Warnings:
44 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
45 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
46 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
47 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
48 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
49 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
50 Warnings:
51 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
52 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
53 Warnings:
54 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
55 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
56 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
57 SET GLOBAL table_encryption_privilege_check=false;
58 # 1.1.
59 # Rename table using file-per-table tablespace from db encryption='y'
60 # to db with encryption='n' and viceversa
61 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
62 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
63 Warnings:
64 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
65 # 1.2.
66 # Rename table using general tablespace from db encryption='y'
67 # to db with encryption='n' and viceversa
68 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
69 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
70 Warnings:
71 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
72 # 1.3.
73 # Rename table (using file-per-table/general tablespace)
74 # within the database never fails.
75 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
76 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
77 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
78 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
79 SET GLOBAL table_encryption_privilege_check=false;
80 SHOW TABLES IN db1;
81 Tables_in_db1
82 fpt1_renamed
83 fpt2
84 ts1_rename
85 ts2
86 SHOW TABLES IN db2;
87 Tables_in_db2
88 fpt1_renamed
89 fpt2
90 ts1_rename
91 ts2
92 SHOW TABLES IN sch1;
93 Tables_in_sch1
94 fpt_renamed
95 ts_renamed
96 SHOW TABLES IN sch2;
97 Tables_in_sch2
98 fpt_renamed
99 ts_renamed
100 DROP DATABASE db1;
101 DROP DATABASE db2;
102 DROP DATABASE sch1;
103 DROP DATABASE sch2;
104 # [ALTER TABLE ... RENAME ...] Case 2 )
105 `````````````````````````````````````````````````````````
106 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
107 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
108 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
109 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
110 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
111 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
112 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
113 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
114 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
115 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
116 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
117 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
118 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
119 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
120 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
121 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
122 SET GLOBAL table_encryption_privilege_check=false;
123 # 2.1.
124 # Rename table using file-per-table tablespace from db encryption='y'
125 # to db with encryption='n' and viceversa
126 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
127 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
128 # 2.2.
129 # Rename table using general tablespace from db encryption='y'
130 # to db with encryption='n' and viceversa
131 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
132 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
133 # 2.3.
134 # Rename table (using file-per-table/general tablespace)
135 # within the database never fails.
136 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
137 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
138 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
139 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
140 SET GLOBAL table_encryption_privilege_check=false;
141 SHOW TABLES IN db1;
142 Tables_in_db1
143 fpt1_renamed
144 fpt2
145 ts1_rename
146 ts2
147 SHOW TABLES IN db2;
148 Tables_in_db2
149 fpt1_renamed
150 fpt2
151 ts1_rename
152 ts2
153 SHOW TABLES IN sch1;
154 Tables_in_sch1
155 fpt_renamed
156 ts_renamed
157 SHOW TABLES IN sch2;
158 Tables_in_sch2
159 fpt_renamed
160 ts_renamed
161 DROP DATABASE db1;
162 DROP DATABASE db2;
163 DROP DATABASE sch1;
164 DROP DATABASE sch2;
165 `````````````````````````````````````````````````````````
166 # table_encryption_privilege_check=true
167 `````````````````````````````````````````````````````````
168 # We expect failure when the table encryption does not match
169 # with default database encryption.
170 # [ALTER TABLE ... RENAME ...] Case 3 )
171 `````````````````````````````````````````````````````````
172 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
173 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
174 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
175 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
176 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
177 Warnings:
178 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
179 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
180 Warnings:
181 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
182 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
183 Warnings:
184 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
185 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
186 Warnings:
187 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
188 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
189 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
190 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
191 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
192 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
193 Warnings:
194 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
195 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
196 Warnings:
197 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
198 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
199 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
200 SET GLOBAL table_encryption_privilege_check=true;
201 # 3.1.
202 # Rename table using file-per-table tablespace from db encryption='y'
203 # to db with encryption='n' and viceversa
204 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
205 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
206 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
207 # 3.2.
208 # Rename table using general tablespace from db encryption='y'
209 # to db with encryption='n' and viceversa
210 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
211 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
212 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
213 # 3.3.
214 # Rename table (using file-per-table/general tablespace)
215 # within the database never fails.
216 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
217 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
218 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
219 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
220 SET GLOBAL table_encryption_privilege_check=false;
221 SHOW TABLES IN db1;
222 Tables_in_db1
223 fpt2
224 ts2
225 SHOW TABLES IN db2;
226 Tables_in_db2
227 fpt1
228 fpt1_renamed
229 fpt2
230 ts1
231 ts1_rename
232 ts2
233 SHOW TABLES IN sch1;
234 Tables_in_sch1
235 fpt_renamed
236 ts_renamed
237 SHOW TABLES IN sch2;
238 Tables_in_sch2
239 fpt_renamed
240 ts_renamed
241 DROP DATABASE db1;
242 DROP DATABASE db2;
243 DROP DATABASE sch1;
244 DROP DATABASE sch2;
245 # [ALTER TABLE ... RENAME ...] Case 4 )
246 `````````````````````````````````````````````````````````
247 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
248 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
249 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
250 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
251 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
252 Warnings:
253 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
254 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
255 Warnings:
256 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
257 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
258 Warnings:
259 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
260 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
261 Warnings:
262 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
263 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
264 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
265 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
266 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
267 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
268 Warnings:
269 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
270 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
271 Warnings:
272 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
273 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
274 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='n';
275 SET GLOBAL table_encryption_privilege_check=true;
276 # Grant user with TABLE_ENCRYPTION_ADMIN
277 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
278 # 4.1.
279 # Rename table using file-per-table tablespace from db encryption='y'
280 # to db with encryption='n' and viceversa
281 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
282 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
283 # 4.2.
284 # Rename table using general tablespace from db encryption='y'
285 # to db with encryption='n' and viceversa
286 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
287 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
288 # 4.3.
289 # Rename table (using file-per-table/general tablespace)
290 # within the database never fails.
291 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
292 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
293 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
294 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
295 SET GLOBAL table_encryption_privilege_check=false;
296 SHOW TABLES IN db1;
297 Tables_in_db1
298 fpt1_renamed
299 fpt2
300 ts1_rename
301 ts2
302 SHOW TABLES IN db2;
303 Tables_in_db2
304 fpt1_renamed
305 fpt2
306 ts1_rename
307 ts2
308 SHOW TABLES IN sch1;
309 Tables_in_sch1
310 fpt_renamed
311 ts_renamed
312 SHOW TABLES IN sch2;
313 Tables_in_sch2
314 fpt_renamed
315 ts_renamed
316 # Revoke TABLE_ENCRYPTION_ADMIN from user.
317 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
318 DROP DATABASE db1;
319 DROP DATABASE db2;
320 DROP DATABASE sch1;
321 DROP DATABASE sch2;
322 `````````````````````````````````````````````````````````
323 # We expect failure when the table encryption does not match
324 # with default database encryption.
325 # [ALTER TABLE ... RENAME ...] Case 5 )
326 `````````````````````````````````````````````````````````
327 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
328 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
329 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
330 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
331 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
332 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
333 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
334 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
335 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
336 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
337 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
338 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
339 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
340 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
341 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
342 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
343 SET GLOBAL table_encryption_privilege_check=true;
344 # 5.1.
345 # Rename table using file-per-table tablespace from db encryption='y'
346 # to db with encryption='n' and viceversa
347 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
348 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
349 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
350 # 5.2.
351 # Rename table using general tablespace from db encryption='y'
352 # to db with encryption='n' and viceversa
353 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
354 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
355 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
356 # 5.3.
357 # Rename table (using file-per-table/general tablespace)
358 # within the database never fails.
359 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
360 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
361 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
362 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
363 SET GLOBAL table_encryption_privilege_check=false;
364 SHOW TABLES IN db1;
365 Tables_in_db1
366 fpt1
367 fpt1_renamed
368 fpt2
369 ts1
370 ts1_rename
371 ts2
372 SHOW TABLES IN db2;
373 Tables_in_db2
374 fpt2
375 ts2
376 SHOW TABLES IN sch1;
377 Tables_in_sch1
378 fpt_renamed
379 ts_renamed
380 SHOW TABLES IN sch2;
381 Tables_in_sch2
382 fpt_renamed
383 ts_renamed
384 DROP DATABASE db1;
385 DROP DATABASE db2;
386 DROP DATABASE sch1;
387 DROP DATABASE sch2;
388 # [ALTER TABLE ... RENAME ...] Case 6 )
389 `````````````````````````````````````````````````````````
390 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
391 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
392 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
393 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
394 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
395 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
396 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
397 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
398 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
399 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
400 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
401 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
402 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
403 CREATE TABLE sch1.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
404 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
405 CREATE TABLE sch2.ts (f1 int) TABLESPACE=innodb_file_per_table ENCRYPTION='y';
406 SET GLOBAL table_encryption_privilege_check=true;
407 # Grant user with TABLE_ENCRYPTION_ADMIN
408 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
409 # 6.1.
410 # Rename table using file-per-table tablespace from db encryption='y'
411 # to db with encryption='n' and viceversa
412 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
413 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
414 # 6.2.
415 # Rename table using general tablespace from db encryption='y'
416 # to db with encryption='n' and viceversa
417 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
418 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
419 # 6.3.
420 # Rename table (using file-per-table/general tablespace)
421 # within the database never fails.
422 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
423 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
424 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
425 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
426 SET GLOBAL table_encryption_privilege_check=false;
427 SHOW TABLES IN db1;
428 Tables_in_db1
429 fpt1_renamed
430 fpt2
431 ts1_rename
432 ts2
433 SHOW TABLES IN db2;
434 Tables_in_db2
435 fpt1_renamed
436 fpt2
437 ts1_rename
438 ts2
439 SHOW TABLES IN sch1;
440 Tables_in_sch1
441 fpt_renamed
442 ts_renamed
443 SHOW TABLES IN sch2;
444 Tables_in_sch2
445 fpt_renamed
446 ts_renamed
447 # Revoke TABLE_ENCRYPTION_ADMIN from user.
448 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
449 DROP DATABASE db1;
450 DROP DATABASE db2;
451 DROP DATABASE sch1;
452 DROP DATABASE sch2;
453 `````````````````````````````````````````````````````````
454 # Test using general tablespace.
455 `````````````````````````````````````````````````````````
456 # table_encryption_privilege_check=false
457 # [ALTER TABLE ... RENAME ...] Case 7 )
458 `````````````````````````````````````````````````````````
459 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
460 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
461 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
462 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
463 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
464 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
465 Warnings:
466 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
467 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
468 Warnings:
469 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
470 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
471 Warnings:
472 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
473 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
474 Warnings:
475 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
476 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
477 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
478 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
479 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
480 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
481 Warnings:
482 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
483 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
484 Warnings:
485 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
486 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
487 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
488 SET GLOBAL table_encryption_privilege_check=false;
489 # 7.1.
490 # Rename table using file-per-table tablespace from db encryption='y'
491 # to db with encryption='n' and viceversa
492 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
493 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
494 Warnings:
495 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
496 # 7.2.
497 # Rename table using general tablespace from db encryption='y'
498 # to db with encryption='n' and viceversa
499 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
500 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
501 Warnings:
502 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
503 # 7.3.
504 # Rename table (using file-per-table/general tablespace)
505 # within the database never fails.
506 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
507 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
508 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
509 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
510 SET GLOBAL table_encryption_privilege_check=false;
511 SHOW TABLES IN db1;
512 Tables_in_db1
513 fpt1_renamed
514 fpt2
515 ts1_rename
516 ts2
517 SHOW TABLES IN db2;
518 Tables_in_db2
519 fpt1_renamed
520 fpt2
521 ts1_rename
522 ts2
523 SHOW TABLES IN sch1;
524 Tables_in_sch1
525 fpt_renamed
526 ts_renamed
527 SHOW TABLES IN sch2;
528 Tables_in_sch2
529 fpt_renamed
530 ts_renamed
531 DROP DATABASE db1;
532 DROP DATABASE db2;
533 DROP DATABASE sch1;
534 DROP DATABASE sch2;
535 DROP TABLESPACE ts1;
536 # [ALTER TABLE ... RENAME ...] Case 8 )
537 `````````````````````````````````````````````````````````
538 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
539 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
540 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
541 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
542 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
543 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
544 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
545 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
546 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
547 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
548 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
549 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
550 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
551 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
552 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
553 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
554 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
555 SET GLOBAL table_encryption_privilege_check=false;
556 # 8.1.
557 # Rename table using file-per-table tablespace from db encryption='y'
558 # to db with encryption='n' and viceversa
559 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
560 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
561 # 8.2.
562 # Rename table using general tablespace from db encryption='y'
563 # to db with encryption='n' and viceversa
564 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
565 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
566 # 8.3.
567 # Rename table (using file-per-table/general tablespace)
568 # within the database never fails.
569 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
570 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
571 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
572 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
573 SET GLOBAL table_encryption_privilege_check=false;
574 SHOW TABLES IN db1;
575 Tables_in_db1
576 fpt1_renamed
577 fpt2
578 ts1_rename
579 ts2
580 SHOW TABLES IN db2;
581 Tables_in_db2
582 fpt1_renamed
583 fpt2
584 ts1_rename
585 ts2
586 SHOW TABLES IN sch1;
587 Tables_in_sch1
588 fpt_renamed
589 ts_renamed
590 SHOW TABLES IN sch2;
591 Tables_in_sch2
592 fpt_renamed
593 ts_renamed
594 DROP DATABASE db1;
595 DROP DATABASE db2;
596 DROP DATABASE sch1;
597 DROP DATABASE sch2;
598 DROP TABLESPACE ts1;
599 `````````````````````````````````````````````````````````
600 # table_encryption_privilege_check=true
601 `````````````````````````````````````````````````````````
602 # We expect failure when the table encryption does not match
603 # with default database encryption.
604 # [ALTER TABLE ... RENAME ...] Case 9 )
605 `````````````````````````````````````````````````````````
606 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
607 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
608 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
609 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
610 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
611 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
612 Warnings:
613 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
614 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
615 Warnings:
616 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
617 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
618 Warnings:
619 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
620 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
621 Warnings:
622 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
623 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
624 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
625 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
626 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
627 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
628 Warnings:
629 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
630 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
631 Warnings:
632 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
633 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
634 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
635 SET GLOBAL table_encryption_privilege_check=true;
636 # 9.1.
637 # Rename table using file-per-table tablespace from db encryption='y'
638 # to db with encryption='n' and viceversa
639 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
640 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
641 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
642 # 9.2.
643 # Rename table using general tablespace from db encryption='y'
644 # to db with encryption='n' and viceversa
645 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
646 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
647 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
648 # 9.3.
649 # Rename table (using file-per-table/general tablespace)
650 # within the database never fails.
651 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
652 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
653 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
654 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
655 SET GLOBAL table_encryption_privilege_check=false;
656 SHOW TABLES IN db1;
657 Tables_in_db1
658 fpt2
659 ts2
660 SHOW TABLES IN db2;
661 Tables_in_db2
662 fpt1
663 fpt1_renamed
664 fpt2
665 ts1
666 ts1_rename
667 ts2
668 SHOW TABLES IN sch1;
669 Tables_in_sch1
670 fpt_renamed
671 ts_renamed
672 SHOW TABLES IN sch2;
673 Tables_in_sch2
674 fpt_renamed
675 ts_renamed
676 DROP DATABASE db1;
677 DROP DATABASE db2;
678 DROP DATABASE sch1;
679 DROP DATABASE sch2;
680 DROP TABLESPACE ts1;
681 # [ALTER TABLE ... RENAME ...] Case 10 )
682 `````````````````````````````````````````````````````````
683 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
684 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
685 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
686 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
687 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
688 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
689 Warnings:
690 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
691 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
692 Warnings:
693 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
694 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
695 Warnings:
696 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
697 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
698 Warnings:
699 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
700 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
701 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
702 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
703 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
704 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
705 Warnings:
706 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
707 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
708 Warnings:
709 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
710 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
711 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
712 SET GLOBAL table_encryption_privilege_check=true;
713 # Grant user with TABLE_ENCRYPTION_ADMIN
714 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
715 # 10.1.
716 # Rename table using file-per-table tablespace from db encryption='y'
717 # to db with encryption='n' and viceversa
718 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
719 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
720 # 10.2.
721 # Rename table using general tablespace from db encryption='y'
722 # to db with encryption='n' and viceversa
723 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
724 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
725 # 10.3.
726 # Rename table (using file-per-table/general tablespace)
727 # within the database never fails.
728 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
729 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
730 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
731 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
732 SET GLOBAL table_encryption_privilege_check=false;
733 SHOW TABLES IN db1;
734 Tables_in_db1
735 fpt1_renamed
736 fpt2
737 ts1_rename
738 ts2
739 SHOW TABLES IN db2;
740 Tables_in_db2
741 fpt1_renamed
742 fpt2
743 ts1_rename
744 ts2
745 SHOW TABLES IN sch1;
746 Tables_in_sch1
747 fpt_renamed
748 ts_renamed
749 SHOW TABLES IN sch2;
750 Tables_in_sch2
751 fpt_renamed
752 ts_renamed
753 # Revoke TABLE_ENCRYPTION_ADMIN from user.
754 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
755 DROP DATABASE db1;
756 DROP DATABASE db2;
757 DROP DATABASE sch1;
758 DROP DATABASE sch2;
759 DROP TABLESPACE ts1;
760 `````````````````````````````````````````````````````````
761 # We expect failure when the table encryption does not match
762 # with default database encryption.
763 # [ALTER TABLE ... RENAME ...] Case 11 )
764 `````````````````````````````````````````````````````````
765 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
766 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
767 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
768 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
769 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
770 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
771 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
772 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
773 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
774 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
775 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
776 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
777 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
778 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
779 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
780 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
781 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
782 SET GLOBAL table_encryption_privilege_check=true;
783 # 11.1.
784 # Rename table using file-per-table tablespace from db encryption='y'
785 # to db with encryption='n' and viceversa
786 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
787 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
788 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
789 # 11.2.
790 # Rename table using general tablespace from db encryption='y'
791 # to db with encryption='n' and viceversa
792 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
793 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
794 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
795 # 11.3.
796 # Rename table (using file-per-table/general tablespace)
797 # within the database never fails.
798 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
799 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
800 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
801 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
802 SET GLOBAL table_encryption_privilege_check=false;
803 SHOW TABLES IN db1;
804 Tables_in_db1
805 fpt1
806 fpt1_renamed
807 fpt2
808 ts1
809 ts1_rename
810 ts2
811 SHOW TABLES IN db2;
812 Tables_in_db2
813 fpt2
814 ts2
815 SHOW TABLES IN sch1;
816 Tables_in_sch1
817 fpt_renamed
818 ts_renamed
819 SHOW TABLES IN sch2;
820 Tables_in_sch2
821 fpt_renamed
822 ts_renamed
823 DROP DATABASE db1;
824 DROP DATABASE db2;
825 DROP DATABASE sch1;
826 DROP DATABASE sch2;
827 DROP TABLESPACE ts1;
828 # [ALTER TABLE ... RENAME ...] Case 12 )
829 `````````````````````````````````````````````````````````
830 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
831 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
832 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
833 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
834 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
835 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
836 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
837 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
838 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
839 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
840 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
841 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
842 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
843 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
844 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
845 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
846 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
847 SET GLOBAL table_encryption_privilege_check=true;
848 # Grant user with TABLE_ENCRYPTION_ADMIN
849 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
850 # 12.1.
851 # Rename table using file-per-table tablespace from db encryption='y'
852 # to db with encryption='n' and viceversa
853 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ;
854 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ;
855 # 12.2.
856 # Rename table using general tablespace from db encryption='y'
857 # to db with encryption='n' and viceversa
858 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ;
859 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ;
860 # 12.3.
861 # Rename table (using file-per-table/general tablespace)
862 # within the database never fails.
863 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ;
864 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ;
865 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ;
866 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ;
867 SET GLOBAL table_encryption_privilege_check=false;
868 SHOW TABLES IN db1;
869 Tables_in_db1
870 fpt1_renamed
871 fpt2
872 ts1_rename
873 ts2
874 SHOW TABLES IN db2;
875 Tables_in_db2
876 fpt1_renamed
877 fpt2
878 ts1_rename
879 ts2
880 SHOW TABLES IN sch1;
881 Tables_in_sch1
882 fpt_renamed
883 ts_renamed
884 SHOW TABLES IN sch2;
885 Tables_in_sch2
886 fpt_renamed
887 ts_renamed
888 # Revoke TABLE_ENCRYPTION_ADMIN from user.
889 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
890 DROP DATABASE db1;
891 DROP DATABASE db2;
892 DROP DATABASE sch1;
893 DROP DATABASE sch2;
894 DROP TABLESPACE ts1;
895 `````````````````````````````````````````````````````````
896 # table_encryption_privilege_check=false
897 # [ALTER TABLE ... RENAME ...] Case 13 )
898 `````````````````````````````````````````````````````````
899 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
900 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
901 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
902 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
903 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
904 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
905 Warnings:
906 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
907 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
908 Warnings:
909 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
910 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
911 Warnings:
912 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
913 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
914 Warnings:
915 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
916 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
917 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
918 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
919 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
920 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
921 Warnings:
922 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
923 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
924 Warnings:
925 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
926 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
927 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
928 SET GLOBAL table_encryption_privilege_check=false;
929 # 13.1.
930 # Rename table using file-per-table tablespace from db encryption='y'
931 # to db with encryption='n' and viceversa
932 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
933 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
934 Warnings:
935 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
936 # 13.2.
937 # Rename table using general tablespace from db encryption='y'
938 # to db with encryption='n' and viceversa
939 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
940 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
941 Warnings:
942 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
943 # 13.3.
944 # Rename table (using file-per-table/general tablespace)
945 # within the database never fails.
946 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
947 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
948 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
949 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
950 SET GLOBAL table_encryption_privilege_check=false;
951 SHOW TABLES IN db1;
952 Tables_in_db1
953 fpt1_renamed
954 fpt2
955 ts1_rename
956 ts2
957 SHOW TABLES IN db2;
958 Tables_in_db2
959 fpt1_renamed
960 fpt2
961 ts1_rename
962 ts2
963 SHOW TABLES IN sch1;
964 Tables_in_sch1
965 fpt_renamed
966 ts_renamed
967 SHOW TABLES IN sch2;
968 Tables_in_sch2
969 fpt_renamed
970 ts_renamed
971 DROP DATABASE db1;
972 DROP DATABASE db2;
973 DROP DATABASE sch1;
974 DROP DATABASE sch2;
975 DROP TABLESPACE ts1;
976 # [ALTER TABLE ... RENAME ...] Case 14 )
977 `````````````````````````````````````````````````````````
978 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
979 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
980 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
981 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
982 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
983 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
984 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
985 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
986 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
987 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
988 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
989 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
990 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
991 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
992 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
993 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
994 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
995 SET GLOBAL table_encryption_privilege_check=false;
996 # 14.1.
997 # Rename table using file-per-table tablespace from db encryption='y'
998 # to db with encryption='n' and viceversa
999 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
1000 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
1001 # 14.2.
1002 # Rename table using general tablespace from db encryption='y'
1003 # to db with encryption='n' and viceversa
1004 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
1005 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
1006 # 14.3.
1007 # Rename table (using file-per-table/general tablespace)
1008 # within the database never fails.
1009 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
1010 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
1011 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
1012 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
1013 SET GLOBAL table_encryption_privilege_check=false;
1014 SHOW TABLES IN db1;
1015 Tables_in_db1
1016 fpt1_renamed
1017 fpt2
1018 ts1_rename
1019 ts2
1020 SHOW TABLES IN db2;
1021 Tables_in_db2
1022 fpt1_renamed
1023 fpt2
1024 ts1_rename
1025 ts2
1026 SHOW TABLES IN sch1;
1027 Tables_in_sch1
1028 fpt_renamed
1029 ts_renamed
1030 SHOW TABLES IN sch2;
1031 Tables_in_sch2
1032 fpt_renamed
1033 ts_renamed
1034 DROP DATABASE db1;
1035 DROP DATABASE db2;
1036 DROP DATABASE sch1;
1037 DROP DATABASE sch2;
1038 DROP TABLESPACE ts1;
1039 `````````````````````````````````````````````````````````
1040 # table_encryption_privilege_check=true
1041 `````````````````````````````````````````````````````````
1042 # We expect failure when the table encryption does not match
1043 # with default database encryption.
1044 # [ALTER TABLE ... RENAME ...] Case 15 )
1045 `````````````````````````````````````````````````````````
1046 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1047 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1048 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1049 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1050 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
1051 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
1052 Warnings:
1053 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1054 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
1055 Warnings:
1056 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1057 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1058 Warnings:
1059 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1060 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1061 Warnings:
1062 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1063 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
1064 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
1065 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1066 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1067 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
1068 Warnings:
1069 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1070 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1071 Warnings:
1072 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1073 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
1074 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1075 SET GLOBAL table_encryption_privilege_check=true;
1076 # 15.1.
1077 # Rename table using file-per-table tablespace from db encryption='y'
1078 # to db with encryption='n' and viceversa
1079 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
1080 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
1081 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1082 # 15.2.
1083 # Rename table using general tablespace from db encryption='y'
1084 # to db with encryption='n' and viceversa
1085 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
1086 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
1087 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1088 # 15.3.
1089 # Rename table (using file-per-table/general tablespace)
1090 # within the database never fails.
1091 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
1092 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
1093 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
1094 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
1095 SET GLOBAL table_encryption_privilege_check=false;
1096 SHOW TABLES IN db1;
1097 Tables_in_db1
1098 fpt2
1099 ts2
1100 SHOW TABLES IN db2;
1101 Tables_in_db2
1102 fpt1
1103 fpt1_renamed
1104 fpt2
1105 ts1
1106 ts1_rename
1107 ts2
1108 SHOW TABLES IN sch1;
1109 Tables_in_sch1
1110 fpt_renamed
1111 ts_renamed
1112 SHOW TABLES IN sch2;
1113 Tables_in_sch2
1114 fpt_renamed
1115 ts_renamed
1116 DROP DATABASE db1;
1117 DROP DATABASE db2;
1118 DROP DATABASE sch1;
1119 DROP DATABASE sch2;
1120 DROP TABLESPACE ts1;
1121 # [ALTER TABLE ... RENAME ...] Case 16 )
1122 `````````````````````````````````````````````````````````
1123 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1124 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1125 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1126 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1127 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
1128 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
1129 Warnings:
1130 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1131 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
1132 Warnings:
1133 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1134 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1135 Warnings:
1136 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1137 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1138 Warnings:
1139 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1140 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
1141 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
1142 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1143 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1144 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
1145 Warnings:
1146 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1147 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1148 Warnings:
1149 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1150 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
1151 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1152 SET GLOBAL table_encryption_privilege_check=true;
1153 # Grant user with TABLE_ENCRYPTION_ADMIN
1154 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
1155 # 16.1.
1156 # Rename table using file-per-table tablespace from db encryption='y'
1157 # to db with encryption='n' and viceversa
1158 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
1159 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
1160 # 16.2.
1161 # Rename table using general tablespace from db encryption='y'
1162 # to db with encryption='n' and viceversa
1163 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
1164 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
1165 # 16.3.
1166 # Rename table (using file-per-table/general tablespace)
1167 # within the database never fails.
1168 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
1169 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
1170 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
1171 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
1172 SET GLOBAL table_encryption_privilege_check=false;
1173 SHOW TABLES IN db1;
1174 Tables_in_db1
1175 fpt1_renamed
1176 fpt2
1177 ts1_rename
1178 ts2
1179 SHOW TABLES IN db2;
1180 Tables_in_db2
1181 fpt1_renamed
1182 fpt2
1183 ts1_rename
1184 ts2
1185 SHOW TABLES IN sch1;
1186 Tables_in_sch1
1187 fpt_renamed
1188 ts_renamed
1189 SHOW TABLES IN sch2;
1190 Tables_in_sch2
1191 fpt_renamed
1192 ts_renamed
1193 # Revoke TABLE_ENCRYPTION_ADMIN from user.
1194 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
1195 DROP DATABASE db1;
1196 DROP DATABASE db2;
1197 DROP DATABASE sch1;
1198 DROP DATABASE sch2;
1199 DROP TABLESPACE ts1;
1200 `````````````````````````````````````````````````````````
1201 # We expect failure when the table encryption does not match
1202 # with default database encryption.
1203 # [ALTER TABLE ... RENAME ...] Case 17 )
1204 `````````````````````````````````````````````````````````
1205 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1206 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1207 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1208 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1209 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1210 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1211 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1212 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1213 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1214 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1215 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1216 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1217 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1218 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1219 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1220 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1221 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1222 SET GLOBAL table_encryption_privilege_check=true;
1223 # 17.1.
1224 # Rename table using file-per-table tablespace from db encryption='y'
1225 # to db with encryption='n' and viceversa
1226 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
1227 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1228 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
1229 # 17.2.
1230 # Rename table using general tablespace from db encryption='y'
1231 # to db with encryption='n' and viceversa
1232 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
1233 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1234 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
1235 # 17.3.
1236 # Rename table (using file-per-table/general tablespace)
1237 # within the database never fails.
1238 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
1239 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
1240 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
1241 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
1242 SET GLOBAL table_encryption_privilege_check=false;
1243 SHOW TABLES IN db1;
1244 Tables_in_db1
1245 fpt1
1246 fpt1_renamed
1247 fpt2
1248 ts1
1249 ts1_rename
1250 ts2
1251 SHOW TABLES IN db2;
1252 Tables_in_db2
1253 fpt2
1254 ts2
1255 SHOW TABLES IN sch1;
1256 Tables_in_sch1
1257 fpt_renamed
1258 ts_renamed
1259 SHOW TABLES IN sch2;
1260 Tables_in_sch2
1261 fpt_renamed
1262 ts_renamed
1263 DROP DATABASE db1;
1264 DROP DATABASE db2;
1265 DROP DATABASE sch1;
1266 DROP DATABASE sch2;
1267 DROP TABLESPACE ts1;
1268 # [ALTER TABLE ... RENAME ...] Case 18 )
1269 `````````````````````````````````````````````````````````
1270 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1271 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1272 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1273 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1274 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1275 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1276 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1277 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1278 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1279 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1280 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1281 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1282 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1283 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1284 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1285 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1286 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1287 SET GLOBAL table_encryption_privilege_check=true;
1288 # Grant user with TABLE_ENCRYPTION_ADMIN
1289 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
1290 # 18.1.
1291 # Rename table using file-per-table tablespace from db encryption='y'
1292 # to db with encryption='n' and viceversa
1293 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,MODIFY f1 CHAR(30);
1294 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,MODIFY f1 CHAR(30);
1295 # 18.2.
1296 # Rename table using general tablespace from db encryption='y'
1297 # to db with encryption='n' and viceversa
1298 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,MODIFY f1 CHAR(30);
1299 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,MODIFY f1 CHAR(30);
1300 # 18.3.
1301 # Rename table (using file-per-table/general tablespace)
1302 # within the database never fails.
1303 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,MODIFY f1 CHAR(30);
1304 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,MODIFY f1 CHAR(30);
1305 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,MODIFY f1 CHAR(30);
1306 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,MODIFY f1 CHAR(30);
1307 SET GLOBAL table_encryption_privilege_check=false;
1308 SHOW TABLES IN db1;
1309 Tables_in_db1
1310 fpt1_renamed
1311 fpt2
1312 ts1_rename
1313 ts2
1314 SHOW TABLES IN db2;
1315 Tables_in_db2
1316 fpt1_renamed
1317 fpt2
1318 ts1_rename
1319 ts2
1320 SHOW TABLES IN sch1;
1321 Tables_in_sch1
1322 fpt_renamed
1323 ts_renamed
1324 SHOW TABLES IN sch2;
1325 Tables_in_sch2
1326 fpt_renamed
1327 ts_renamed
1328 # Revoke TABLE_ENCRYPTION_ADMIN from user.
1329 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
1330 DROP DATABASE db1;
1331 DROP DATABASE db2;
1332 DROP DATABASE sch1;
1333 DROP DATABASE sch2;
1334 DROP TABLESPACE ts1;
1335 `````````````````````````````````````````````````````````
1336 # table_encryption_privilege_check=false
1337 # [ALTER TABLE ... RENAME ...] Case 19 )
1338 `````````````````````````````````````````````````````````
1339 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1340 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1341 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1342 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1343 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
1344 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
1345 Warnings:
1346 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1347 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
1348 Warnings:
1349 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1350 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1351 Warnings:
1352 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1353 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1354 Warnings:
1355 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1356 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
1357 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
1358 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1359 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1360 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
1361 Warnings:
1362 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1363 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1364 Warnings:
1365 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1366 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
1367 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1368 SET GLOBAL table_encryption_privilege_check=false;
1369 # 19.1.
1370 # Rename table using file-per-table tablespace from db encryption='y'
1371 # to db with encryption='n' and viceversa
1372 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1373 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1374 Warnings:
1375 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1376 # 19.2.
1377 # Rename table using general tablespace from db encryption='y'
1378 # to db with encryption='n' and viceversa
1379 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1380 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1381 Warnings:
1382 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1383 # 19.3.
1384 # Rename table (using file-per-table/general tablespace)
1385 # within the database never fails.
1386 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1387 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1388 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1389 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1390 SET GLOBAL table_encryption_privilege_check=false;
1391 SHOW TABLES IN db1;
1392 Tables_in_db1
1393 fpt1_renamed
1394 fpt2
1395 ts1_rename
1396 ts2
1397 SHOW TABLES IN db2;
1398 Tables_in_db2
1399 fpt1_renamed
1400 fpt2
1401 ts1_rename
1402 ts2
1403 SHOW TABLES IN sch1;
1404 Tables_in_sch1
1405 fpt_renamed
1406 ts_renamed
1407 SHOW TABLES IN sch2;
1408 Tables_in_sch2
1409 fpt_renamed
1410 ts_renamed
1411 DROP DATABASE db1;
1412 DROP DATABASE db2;
1413 DROP DATABASE sch1;
1414 DROP DATABASE sch2;
1415 DROP TABLESPACE ts1;
1416 # [ALTER TABLE ... RENAME ...] Case 20 )
1417 `````````````````````````````````````````````````````````
1418 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1419 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1420 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1421 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1422 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1423 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1424 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1425 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1426 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1427 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1428 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1429 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1430 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1431 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1432 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1433 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1434 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1435 SET GLOBAL table_encryption_privilege_check=false;
1436 # 20.1.
1437 # Rename table using file-per-table tablespace from db encryption='y'
1438 # to db with encryption='n' and viceversa
1439 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1440 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1441 # 20.2.
1442 # Rename table using general tablespace from db encryption='y'
1443 # to db with encryption='n' and viceversa
1444 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1445 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1446 # 20.3.
1447 # Rename table (using file-per-table/general tablespace)
1448 # within the database never fails.
1449 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1450 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1451 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1452 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1453 SET GLOBAL table_encryption_privilege_check=false;
1454 SHOW TABLES IN db1;
1455 Tables_in_db1
1456 fpt1_renamed
1457 fpt2
1458 ts1_rename
1459 ts2
1460 SHOW TABLES IN db2;
1461 Tables_in_db2
1462 fpt1_renamed
1463 fpt2
1464 ts1_rename
1465 ts2
1466 SHOW TABLES IN sch1;
1467 Tables_in_sch1
1468 fpt_renamed
1469 ts_renamed
1470 SHOW TABLES IN sch2;
1471 Tables_in_sch2
1472 fpt_renamed
1473 ts_renamed
1474 DROP DATABASE db1;
1475 DROP DATABASE db2;
1476 DROP DATABASE sch1;
1477 DROP DATABASE sch2;
1478 DROP TABLESPACE ts1;
1479 `````````````````````````````````````````````````````````
1480 # table_encryption_privilege_check=true
1481 `````````````````````````````````````````````````````````
1482 # We expect failure when the table encryption does not match
1483 # with default database encryption.
1484 # [ALTER TABLE ... RENAME ...] Case 21 )
1485 `````````````````````````````````````````````````````````
1486 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1487 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1488 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1489 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1490 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='n';
1491 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='n';
1492 Warnings:
1493 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1494 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='n';
1495 Warnings:
1496 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1497 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1498 Warnings:
1499 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1500 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1501 Warnings:
1502 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1503 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='n';
1504 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='n';
1505 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1506 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1507 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='n';
1508 Warnings:
1509 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1510 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1511 Warnings:
1512 Warning 3824 Creating an unencrypted table in a database with default encryption enabled.
1513 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='n';
1514 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='n';
1515 SET GLOBAL table_encryption_privilege_check=true;
1516 # 21.1.
1517 # Rename table using file-per-table tablespace from db encryption='y'
1518 # to db with encryption='n' and viceversa
1519 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1520 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1521 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1522 # 21.2.
1523 # Rename table using general tablespace from db encryption='y'
1524 # to db with encryption='n' and viceversa
1525 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1526 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1527 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1528 # 21.3.
1529 # Rename table (using file-per-table/general tablespace)
1530 # within the database never fails.
1531 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1532 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1533 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1534 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1535 SET GLOBAL table_encryption_privilege_check=false;
1536 SHOW TABLES IN db1;
1537 Tables_in_db1
1538 fpt2
1539 ts2
1540 SHOW TABLES IN db2;
1541 Tables_in_db2
1542 fpt1
1543 fpt1_renamed
1544 fpt2
1545 ts1
1546 ts1_rename
1547 ts2
1548 SHOW TABLES IN sch1;
1549 Tables_in_sch1
1550 fpt_renamed
1551 ts_renamed
1552 SHOW TABLES IN sch2;
1553 Tables_in_sch2
1554 fpt_renamed
1555 ts_renamed
1556 DROP DATABASE db1;
1557 DROP DATABASE db2;
1558 DROP DATABASE sch1;
1559 DROP DATABASE sch2;
1560 DROP TABLESPACE ts1;
1561 # [ALTER TABLE ... RENAME ...] Case 22 )
1562 `````````````````````````````````````````````````````````
1563 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1564 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1565 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1566 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1567 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1568 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1569 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1570 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1571 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1572 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1573 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1574 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1575 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1576 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1577 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1578 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1579 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1580 SET GLOBAL table_encryption_privilege_check=true;
1581 # Grant user with TABLE_ENCRYPTION_ADMIN
1582 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
1583 # 22.1.
1584 # Rename table using file-per-table tablespace from db encryption='y'
1585 # to db with encryption='n' and viceversa
1586 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1587 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1588 # 22.2.
1589 # Rename table using general tablespace from db encryption='y'
1590 # to db with encryption='n' and viceversa
1591 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1592 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1593 # 22.3.
1594 # Rename table (using file-per-table/general tablespace)
1595 # within the database never fails.
1596 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1597 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1598 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1599 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1600 SET GLOBAL table_encryption_privilege_check=false;
1601 SHOW TABLES IN db1;
1602 Tables_in_db1
1603 fpt1_renamed
1604 fpt2
1605 ts1_rename
1606 ts2
1607 SHOW TABLES IN db2;
1608 Tables_in_db2
1609 fpt1_renamed
1610 fpt2
1611 ts1_rename
1612 ts2
1613 SHOW TABLES IN sch1;
1614 Tables_in_sch1
1615 fpt_renamed
1616 ts_renamed
1617 SHOW TABLES IN sch2;
1618 Tables_in_sch2
1619 fpt_renamed
1620 ts_renamed
1621 # Revoke TABLE_ENCRYPTION_ADMIN from user.
1622 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
1623 DROP DATABASE db1;
1624 DROP DATABASE db2;
1625 DROP DATABASE sch1;
1626 DROP DATABASE sch2;
1627 DROP TABLESPACE ts1;
1628 `````````````````````````````````````````````````````````
1629 # We expect failure when the table encryption does not match
1630 # with default database encryption.
1631 # [ALTER TABLE ... RENAME ...] Case 23 )
1632 `````````````````````````````````````````````````````````
1633 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1634 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1635 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1636 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1637 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1638 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1639 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1640 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1641 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1642 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1643 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1644 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1645 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1646 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1647 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1648 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1649 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1650 SET GLOBAL table_encryption_privilege_check=true;
1651 # 23.1.
1652 # Rename table using file-per-table tablespace from db encryption='y'
1653 # to db with encryption='n' and viceversa
1654 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1655 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1656 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1657 # 23.2.
1658 # Rename table using general tablespace from db encryption='y'
1659 # to db with encryption='n' and viceversa
1660 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1661 ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege.
1662 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1663 # 23.3.
1664 # Rename table (using file-per-table/general tablespace)
1665 # within the database never fails.
1666 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1667 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1668 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1669 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1670 SET GLOBAL table_encryption_privilege_check=false;
1671 SHOW TABLES IN db1;
1672 Tables_in_db1
1673 fpt1
1674 fpt1_renamed
1675 fpt2
1676 ts1
1677 ts1_rename
1678 ts2
1679 SHOW TABLES IN db2;
1680 Tables_in_db2
1681 fpt2
1682 ts2
1683 SHOW TABLES IN sch1;
1684 Tables_in_sch1
1685 fpt_renamed
1686 ts_renamed
1687 SHOW TABLES IN sch2;
1688 Tables_in_sch2
1689 fpt_renamed
1690 ts_renamed
1691 DROP DATABASE db1;
1692 DROP DATABASE db2;
1693 DROP DATABASE sch1;
1694 DROP DATABASE sch2;
1695 DROP TABLESPACE ts1;
1696 # [ALTER TABLE ... RENAME ...] Case 24 )
1697 `````````````````````````````````````````````````````````
1698 CREATE DATABASE db1 DEFAULT ENCRYPTION='y';
1699 CREATE DATABASE db2 DEFAULT ENCRYPTION='n';
1700 CREATE DATABASE sch1 DEFAULT ENCRYPTION='y';
1701 CREATE DATABASE sch2 DEFAULT ENCRYPTION='n';
1702 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y';
1703 CREATE TABLE db1.fpt1 (f1 int) ENCRYPTION='y';
1704 CREATE TABLE db1.fpt2 (f1 int) ENCRYPTION='y';
1705 CREATE TABLE db1.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1706 CREATE TABLE db1.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1707 CREATE TABLE db2.fpt1 (f1 int) ENCRYPTION='y';
1708 CREATE TABLE db2.fpt2 (f1 int) ENCRYPTION='y';
1709 CREATE TABLE db2.ts1 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1710 CREATE TABLE db2.ts2 (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1711 CREATE TABLE sch1.fpt (f1 int) ENCRYPTION='y';
1712 CREATE TABLE sch1.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1713 CREATE TABLE sch2.fpt (f1 int) ENCRYPTION='y';
1714 CREATE TABLE sch2.ts (f1 int) TABLESPACE=ts1 ENCRYPTION='y';
1715 SET GLOBAL table_encryption_privilege_check=true;
1716 # Grant user with TABLE_ENCRYPTION_ADMIN
1717 GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost;
1718 # 24.1.
1719 # Rename table using file-per-table tablespace from db encryption='y'
1720 # to db with encryption='n' and viceversa
1721 ALTER TABLE db1.fpt1 RENAME db2.fpt1_renamed ,ADD f2 CHAR(30);
1722 ALTER TABLE db2.fpt1 RENAME db1.fpt1_renamed ,ADD f2 CHAR(30);
1723 # 24.2.
1724 # Rename table using general tablespace from db encryption='y'
1725 # to db with encryption='n' and viceversa
1726 ALTER TABLE db1.ts1 RENAME db2.ts1_rename ,ADD f2 CHAR(30);
1727 ALTER TABLE db2.ts1 RENAME db1.ts1_rename ,ADD f2 CHAR(30);
1728 # 24.3.
1729 # Rename table (using file-per-table/general tablespace)
1730 # within the database never fails.
1731 ALTER TABLE sch1.fpt RENAME sch1.fpt_renamed ,ADD f2 CHAR(30);
1732 ALTER TABLE sch1.ts RENAME sch1.ts_renamed ,ADD f2 CHAR(30);
1733 ALTER TABLE sch2.fpt RENAME sch2.fpt_renamed ,ADD f2 CHAR(30);
1734 ALTER TABLE sch2.ts RENAME sch2.ts_renamed ,ADD f2 CHAR(30);
1735 SET GLOBAL table_encryption_privilege_check=false;
1736 SHOW TABLES IN db1;
1737 Tables_in_db1
1738 fpt1_renamed
1739 fpt2
1740 ts1_rename
1741 ts2
1742 SHOW TABLES IN db2;
1743 Tables_in_db2
1744 fpt1_renamed
1745 fpt2
1746 ts1_rename
1747 ts2
1748 SHOW TABLES IN sch1;
1749 Tables_in_sch1
1750 fpt_renamed
1751 ts_renamed
1752 SHOW TABLES IN sch2;
1753 Tables_in_sch2
1754 fpt_renamed
1755 ts_renamed
1756 # Revoke TABLE_ENCRYPTION_ADMIN from user.
1757 REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost;
1758 DROP DATABASE db1;
1759 DROP DATABASE db2;
1760 DROP DATABASE sch1;
1761 DROP DATABASE sch2;
1762 DROP TABLESPACE ts1;
1763 # Cleanup
1764 DROP USER u1@localhost;
1765 SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set';