MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
partition_alter2_2.inc
1 ################################################################################
2 # inc/partition_alter2_2.inc #
3 # #
4 # Purpose: #
5 # Tests where the columns used within the partitioning function are altered. #
6 # This routine is only useful for the partition_<feature>_<engine> tests. .#
7 # Part 2: decreasing size of column
8 # #
9 #------------------------------------------------------------------------------#
10 # Original Author: mleich #
11 # Original Date: 2006-03-05 #
12 # Change Author: MattiasJ #
13 # Change Date: 2008-09-08 #
14 # Change: Splitted the test in two different parts (increasing/decreasing col) #
15 ################################################################################
16 
17 if (!$only_part_2)
18 {
19 --echo
20 --echo #========================================================================
21 --echo # 2 Decrease the size of the column used in the partitioning
22 --echo # function and/or PRIMARY KEY and/or UNIQUE INDEX
23 --echo #========================================================================
24 --echo #------------------------------------------------------------------------
25 --echo # 2.1 ALTER column f_int2 not used in partitioning function
26 --echo #------------------------------------------------------------------------
27 # Rule: Only f_int1 is used within the partitioning function
28 # ---> inc/partition_alter_11.inc
29 let $alter= ALTER TABLE t1 MODIFY f_int2 MEDIUMINT;
30 --echo # 2.1.1 no PRIMARY KEY or UNIQUE INDEX exists
31 let $unique= ;
32 --source suite/parts/inc/partition_alter_11.inc
33 #
34 if ($do_pk_tests)
35 {
36  # The value of the direct following test is maybe covered by the test with
37  # the PRIMARY KEY containing two columns.
38  if ($more_pk_ui_tests)
39  {
40  --echo # 2.1.2 PRIMARY KEY exists
41  let $unique= , PRIMARY KEY (f_int1);
42  --source suite/parts/inc/partition_alter_11.inc
43  }
44  let $unique= , PRIMARY KEY (f_int1,f_int2);
45  --source suite/parts/inc/partition_alter_11.inc
46  let $unique= , PRIMARY KEY (f_int2,f_int1);
47  --source suite/parts/inc/partition_alter_11.inc
48 }
49 #
50 --echo # 2.1.3 UNIQUE INDEX exists
51 # The value of the direct following test is maybe covered by the test with
52 # the UNIQUE INDEX containing two columns.
53 if ($more_pk_ui_tests)
54 {
55  let $unique= , UNIQUE INDEX uidx1 (f_int1);
56  --source suite/parts/inc/partition_alter_11.inc
57 }
58 let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2);
59 --source suite/parts/inc/partition_alter_11.inc
60 let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1);
61 --source suite/parts/inc/partition_alter_11.inc
62 #
63 if ($more_pk_ui_tests)
64 {
65  # The value of the tests 2.2 is maybe covered by the tests 2.3
66  --echo #------------------------------------------------------------------------
67  --echo # 2.2 ALTER column f_int1 used in partitioning function
68  --echo #------------------------------------------------------------------------
69  # Rule: Only f_int1 is used within the partitioning function
70  # ---> inc/partition_alter_11.inc
71  let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT;
72  --echo # 2.2.1 no PRIMARY KEY or UNIQUE INDEX exists
73  let $unique= ;
74  --source suite/parts/inc/partition_alter_11.inc
75  --source suite/parts/inc/partition_alter_13.inc
76  #
77  if ($do_pk_tests)
78  {
79  --echo # 2.2.2 PRIMARY KEY exists
80  let $unique= , PRIMARY KEY (f_int1);
81  --source suite/parts/inc/partition_alter_11.inc
82  let $unique= , PRIMARY KEY (f_int1,f_int2);
83  --source suite/parts/inc/partition_alter_11.inc
84  --source suite/parts/inc/partition_alter_13.inc
85  let $unique= , PRIMARY KEY (f_int2,f_int1);
86  --source suite/parts/inc/partition_alter_11.inc
87  --source suite/parts/inc/partition_alter_13.inc
88  }
89  #
90  --echo # 2.2.3 UNIQUE INDEX exists
91  let $unique= , UNIQUE INDEX uidx (f_int1);
92  --source suite/parts/inc/partition_alter_11.inc
93  let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
94  --source suite/parts/inc/partition_alter_11.inc
95  --source suite/parts/inc/partition_alter_13.inc
96  let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
97  --source suite/parts/inc/partition_alter_11.inc
98  --source suite/parts/inc/partition_alter_13.inc
99 }
100 }
101 #
102 if (!$only_part_1)
103 {
104 --echo #------------------------------------------------------------------------
105 --echo # 2.3 ALTER column f_int1 and f_int2 used in partitioning function
106 --echo #------------------------------------------------------------------------
107 # Rule: f_int1 and f_int2 is used within the partitioning function
108 # ---> inc/partition_alter_13.inc
109 let $alter= ALTER TABLE t1 MODIFY f_int1 MEDIUMINT, MODIFY f_int2 MEDIUMINT;
110 --echo # 2.3.1 no PRIMARY KEY or UNIQUE INDEX exists
111 let $unique= ;
112 #--source suite/parts/inc/partition_alter_11.inc
113 --source suite/parts/inc/partition_alter_13.inc
114 #
115 if ($do_pk_tests)
116 {
117  --echo # 2.3.2 PRIMARY KEY exists
118  # The value of the direct following test is maybe covered by the test with
119  # the PRIMARY KEY containing two columns.
120  if ($more_pk_ui_tests)
121  {
122  let $unique= , PRIMARY KEY (f_int1);
123  --source suite/parts/inc/partition_alter_11.inc
124  }
125  let $unique= , PRIMARY KEY (f_int1,f_int2);
126  #--source suite/parts/inc/partition_alter_11.inc
127  --source suite/parts/inc/partition_alter_13.inc
128  let $unique= , PRIMARY KEY (f_int2,f_int1);
129  #--source suite/parts/inc/partition_alter_11.inc
130  --source suite/parts/inc/partition_alter_13.inc
131 }
132 #
133 --echo # 2.3.3 UNIQUE INDEX exists
134 # The value of the direct following test is maybe covered by the test with
135 # the UNIQUE INDEX containing two columns.
136 if ($more_pk_ui_tests)
137 {
138  let $unique= , UNIQUE INDEX uidx (f_int1);
139  --source suite/parts/inc/partition_alter_11.inc
140 }
141 let $unique= , UNIQUE INDEX uidx (f_int1,f_int2);
142 #--source suite/parts/inc/partition_alter_11.inc
143 --source suite/parts/inc/partition_alter_13.inc
144 let $unique= , UNIQUE INDEX uidx (f_int2,f_int1);
145 #--source suite/parts/inc/partition_alter_11.inc
146 --source suite/parts/inc/partition_alter_13.inc
147 }
148 #
149 
150 if (0)
151 {
152 --echo
153 --echo #========================================================================
154 --echo # 3 ALTER the type of the column used in the partitioning
155 --echo # function and/or PRIMARY KEY and/or UNIQUE INDEX
156 --echo # INTEGER --> FLOAT
157 --echo # INTEGER --> DECIMAL
158 --echo # INTEGER --> VARCHAR
159 --echo # mleich: I assume that at least the first two variants are of
160 --echo # some interest. But I am unsure if the server allows such
161 --echo # conversions. I also think that such operations have a
162 --echo # conversions very small likelihood.
163 --echo # To be implemented.
164 --echo #========================================================================
165 }