Debian Codegraph @

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

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