1 ################################################################################
2 # inc/partition_alter1_2.inc #
5 # ADD/DROP PRIMARY KEYs and/or UNIQUE INDEXes tests on partitioned tables #
6 # This routine is only useful for the partition_<feature>_<engine> tests. #
8 #------------------------------------------------------------------------------#
9 # Original Author: mleich #
10 # Original Date: 2006-03-05 #
14 ################################################################################
17 --echo #========================================================================
18 --echo # 2 DROP PRIMARY
KEY or UNIQUE INDEX
19 --echo #========================================================================
20 # Rule: The table must have a PRIMARY KEY or UNIQUE INDEX.
21 # ---> $unique must not be empty
22 # ---> The PRIMARY KEY or UNIQUE INDEX to be dropped must contain
23 # the columns used for partitioning.
24 --echo #------------------------------------------------------------------------
25 --echo # 2.1 Partitioning
function contains one column(f_int1)
26 --echo #------------------------------------------------------------------------
27 # Rule: Only f_int1 is used within the partitioning function
28 # ---> inc/partition_alter_11.inc
29 # The value of the following test is maybe covered by 2.1.5.
30 if ($more_pk_ui_tests)
34 --echo # 2.1.1 DROP PRIMARY
KEY consisting of one column
35 let $unique= , PRIMARY
KEY(f_int1);
36 let $alter= ALTER
TABLE t1 DROP PRIMARY
KEY;
37 --source suite/parts/inc/partition_alter_11.inc
40 --echo # 2.1.2 DROP UNIQUE INDEX consisting of one column
41 let $unique= , UNIQUE INDEX uidx1 (f_int1);
42 let $alter= ALTER
TABLE t1 DROP INDEX uidx1;
43 --source suite/parts/inc/partition_alter_11.inc
47 --echo # 2.1.3 DROP PRIMARY
KEY consisting of two columns
48 let $alter= ALTER
TABLE t1 DROP PRIMARY
KEY;
49 let $unique= , PRIMARY KEY(f_int1,f_int2);
50 --source suite/parts/inc/partition_alter_11.inc
51 let $unique= , PRIMARY KEY(f_int2,f_int1);
52 --source suite/parts/inc/partition_alter_11.inc
55 --echo # 2.1.4 DROP UNIQUE INDEX consisting of two columns
56 let $alter= ALTER
TABLE t1 DROP INDEX uidx1;
57 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2);
58 --source suite/parts/inc/partition_alter_11.inc
59 let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1);
60 --source suite/parts/inc/partition_alter_11.inc
65 --echo # 2.1.5 DROP PRIMARY
KEY + UNIQUE INDEX consisting of two columns
66 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY
KEY(f_int2,f_int1);
67 let $alter= ALTER
TABLE t1 DROP PRIMARY
KEY, DROP INDEX uidx1;
68 --source suite/parts/inc/partition_alter_11.inc
69 let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2);
70 let $alter= ALTER
TABLE t1 DROP PRIMARY KEY, DROP INDEX uidx1;
71 --source suite/parts/inc/partition_alter_11.inc
73 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1);
74 let $alter= ALTER
TABLE t1 DROP INDEX uidx1, DROP INDEX uidx2;
75 --source suite/parts/inc/partition_alter_11.inc
77 --echo #------------------------------------------------------------------------
78 --echo # 2.2 Partitioning
function contains two columns (f_int1,f_int2)
79 --echo #------------------------------------------------------------------------
80 # Rule: f_int1 and f_int2 is used within the partitioning function
81 # ---> inc/partition_alter_13.inc
84 --echo # 2.2.1 DROP PRIMARY
KEY consisting of two columns
85 let $alter= ALTER
TABLE t1 DROP PRIMARY
KEY;
86 let $unique= , PRIMARY KEY(f_int1,f_int2);
87 --source suite/parts/inc/partition_alter_13.inc
88 let $unique= , PRIMARY KEY(f_int2,f_int1);
89 --source suite/parts/inc/partition_alter_13.inc
92 --echo # 2.2.2 DROP UNIQUE INDEX consisting of two columns
93 let $alter= ALTER
TABLE t1 DROP INDEX uidx1;
94 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2);
95 --source suite/parts/inc/partition_alter_13.inc
96 let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1);
97 --source suite/parts/inc/partition_alter_13.inc
101 --echo # 2.2.3 DROP PRIMARY
KEY + UNIQUE INDEX consisting of two columns
102 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY
KEY(f_int2,f_int1);
103 let $alter= ALTER
TABLE t1 DROP PRIMARY
KEY, DROP INDEX uidx1;
104 --source suite/parts/inc/partition_alter_13.inc
105 let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2);
106 let $alter= ALTER
TABLE t1 DROP PRIMARY KEY, DROP INDEX uidx1;
107 --source suite/parts/inc/partition_alter_13.inc
109 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1);
110 let $alter= ALTER
TABLE t1 DROP INDEX uidx1, DROP INDEX uidx2;
111 --source suite/parts/inc/partition_alter_13.inc
116 --echo #========================================================================
117 --echo # 3. ALTER
TABLE "ALTER" PRIMARY
KEY
118 --echo # mleich: I think that an ALTER
TABLE statement where a PRIMARY
119 --echo #
KEY is dropped and recreated (with different layout) might
120 --echo # be of interest,
if the tree containing the
table data has
121 --echo #
to be reorganized during
this operation.
122 --echo # To be implemented
123 --echo #========================================================================