Debian Codegraph @

mysql-test/suite/ndb_ddl/rename_multi.test

raw
1 --source setup.inc
2
3 # Test RENAME TABLE with more than one table
4 # - RENAME TABLE tbl_name TO new_tbl_name [, tbl_name2 TO new_tbl_name2] ...
5 # - The MySQL Server will call ha_ndbcluster several times to
6 # rename the tables one by one
7 let $sql = RENAME TABLE;
8
9 # 1. Rename to <tabname>_new_name
10 let $sql = $sql t1 to t1_new_name,;
11
12 # 2. Rename to same name, skip since expected fail
13
14 # 3. Rename to same name but different db
15 let $sql = $sql t3 to ndb_ddl_test2.t3,;
16
17 # 4. Rename to different name and different db
18 let $sql = $sql t4 to ndb_ddl_test2.t4_new_name;
19
20 eval $sql;
21
22 --source verify_mysql_dd.inc
23
24 # Check behaviour of multi RENAME to same name
25 USE ndb_ddl_test;
26 --error ER_TABLE_EXISTS_ERROR
27 RENAME TABLE t5 to t50, t2 to t2;
28
29 --source verify_mysql_dd.inc
30
31 # Check behaviour of multi RENAME renaming same table multiple times
32 USE ndb_ddl_test;
33 SHOW CREATE TABLE t2;
34 SHOW CREATE TABLE t5;
35 RENAME TABLE t2 to t2_temp_name, t5 to t2, t2_temp_name to t5;
36 # The tables t2 and t5 should have swapped by now
37 SHOW CREATE TABLE t2;
38 SHOW CREATE TABLE t5;
39
40 --source verify_mysql_dd.inc
41
42 # Check behaviour of multi RENAME renaming same table multiple times
43 # and then renaming it into a existing table name
44 USE ndb_ddl_test;
45 --error ER_TABLE_EXISTS_ERROR
46 RENAME TABLE t5 to t50, t50 to t500, t500 to t2;
47 # The tables should remain the same as before
48 SHOW CREATE TABLE t2;
49 SHOW CREATE TABLE t5;
50
51 --source verify_mysql_dd.inc
52
53 --source cleanup.inc