| 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 RENAME TABLE 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 68 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 75 |
RENAME TABLE db2.ts1 TO 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 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 82 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 83 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 84 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 133 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 138 |
RENAME TABLE db2.ts1 TO db1.ts1_rename; |
| 139 |
# 2.3. |
| 140 |
# Rename table (using file-per-table/general tablespace) |
| 141 |
# within the database never fails. |
| 142 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 143 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 144 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 145 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 211 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 217 |
RENAME TABLE db2.ts1 TO 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 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 223 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 224 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 225 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 354 |
ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. |
| 355 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 360 |
ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. |
| 361 |
RENAME TABLE db2.ts1 TO db1.ts1_rename; |
| 362 |
# 5.3. |
| 363 |
# Rename table (using file-per-table/general tablespace) |
| 364 |
# within the database never fails. |
| 365 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 366 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 367 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 368 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 499 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 506 |
RENAME TABLE db2.ts1 TO 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 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 513 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 514 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 515 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 566 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 571 |
RENAME TABLE db2.ts1 TO db1.ts1_rename; |
| 572 |
# 8.3. |
| 573 |
# Rename table (using file-per-table/general tablespace) |
| 574 |
# within the database never fails. |
| 575 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 576 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 577 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 578 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 646 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 652 |
RENAME TABLE db2.ts1 TO 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 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 658 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 659 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 660 |
RENAME TABLE sch2.ts TO 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 |
RENAME TABLE db1.fpt1 TO db2.fpt1_renamed; |
| 793 |
ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. |
| 794 |
RENAME TABLE db2.fpt1 TO 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 |
RENAME TABLE db1.ts1 TO db2.ts1_rename; |
| 799 |
ERROR HY000: Table encryption differ from its database default encryption, and user doesn't have enough privilege. |
| 800 |
RENAME TABLE db2.ts1 TO db1.ts1_rename; |
| 801 |
# 11.3. |
| 802 |
# Rename table (using file-per-table/general tablespace) |
| 803 |
# within the database never fails. |
| 804 |
RENAME TABLE sch1.fpt TO sch1.fpt_renamed; |
| 805 |
RENAME TABLE sch1.ts TO sch1.ts_renamed; |
| 806 |
RENAME TABLE sch2.fpt TO sch2.fpt_renamed; |
| 807 |
RENAME TABLE sch2.ts TO 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 |
# Cleanup |
| 902 |
DROP USER u1@localhost; |
| 903 |
SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set'; |
| 904 |
# ---------------------------------------------------------------------- |
| 905 |
# Teardown |
| 906 |
# Removing manifest file for current MySQL server instance |
| 907 |
# Removing local keyring file for keyring component: component_keyring_file |
| 908 |
# Removing local configuration file for keyring component: component_keyring_file |
| 909 |
# Restarting server without the manifest file |
| 910 |
# ---------------------------------------------------------------------- |