| 1 |
################################################################################ |
| 2 |
# inc/partition_alter1_1.inc # |
| 3 |
# # |
| 4 |
# Purpose: # |
| 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. # |
| 7 |
# # |
| 8 |
#------------------------------------------------------------------------------# |
| 9 |
# Original Author: mleich # |
| 10 |
# Original Date: 2006-03-05 # |
| 11 |
# Change Author: # |
| 12 |
# Change Date: # |
| 13 |
# Change: # |
| 14 |
################################################################################ |
| 15 |
|
| 16 |
--echo |
| 17 |
--echo #======================================================================== |
| 18 |
--echo # 1. ALTER TABLE ADD PRIMARY KEY and/or UNIQUE INDEX |
| 19 |
--echo #======================================================================== |
| 20 |
# Rule: The table does not have a PRIMARY KEY or UNIQUE INDEX. |
| 21 |
# ---> $unique must be empty |
| 22 |
# ---> The PRIMARY KEY or UNIQUE INDEX to be created must contain |
| 23 |
# the columns used for partitioning. |
| 24 |
--echo #------------------------------------------------------------------------ |
| 25 |
--echo # 1.1 ADD PRIMARY KEY or UNIQUE INDEX to table with one column (f_int1) |
| 26 |
--echo # within the partitioning function |
| 27 |
--echo #------------------------------------------------------------------------ |
| 28 |
# Rule: Only f_int1 is used within the partitioning function |
| 29 |
# ---> inc/partition_alter_11.inc |
| 30 |
if ($do_pk_tests) |
| 31 |
{ |
| 32 |
# The value of the following test is maybe covered by 1.1.3. |
| 33 |
if ($more_pk_ui_tests) |
| 34 |
{ |
| 35 |
--echo # 1.1.1 PRIMARY KEY consisting of one column |
| 36 |
let $alter= ALTER TABLE t1 ADD PRIMARY KEY(f_int1); |
| 37 |
--source suite/parts/inc/partition_alter_11.inc |
| 38 |
} |
| 39 |
# This must fail, because PRIMARY KEY does not contain f_int1 |
| 40 |
let $alter= ALTER TABLE t1 ADD PRIMARY KEY(f_int2); |
| 41 |
--source suite/parts/inc/partition_alter_11.inc |
| 42 |
} |
| 43 |
# The value of the following test is maybe covered by 1.1.4. |
| 44 |
if ($more_pk_ui_tests) |
| 45 |
{ |
| 46 |
--echo # 1.1.2 UNIQUE INDEX consisting of one column |
| 47 |
let $alter= ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int1); |
| 48 |
--source suite/parts/inc/partition_alter_11.inc |
| 49 |
} |
| 50 |
# This must fail, because UNIQUE INDEX does not contain f_int1 |
| 51 |
let $alter= ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2); |
| 52 |
--source suite/parts/inc/partition_alter_11.inc |
| 53 |
if ($do_pk_tests) |
| 54 |
{ |
| 55 |
--echo # 1.1.3 PRIMARY KEY consisting of two columns |
| 56 |
let $alter= ALTER TABLE t1 ADD PRIMARY KEY(f_int1,f_int2); |
| 57 |
--source suite/parts/inc/partition_alter_11.inc |
| 58 |
let $alter= ALTER TABLE t1 ADD PRIMARY KEY(f_int2,f_int1); |
| 59 |
--source suite/parts/inc/partition_alter_11.inc |
| 60 |
} |
| 61 |
--echo # 1.1.4 UNIQUE INDEX consisting of two columns |
| 62 |
let $alter= ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int1,f_int2); |
| 63 |
--source suite/parts/inc/partition_alter_11.inc |
| 64 |
let $alter= ALTER TABLE t1 ADD UNIQUE INDEX uidx1 (f_int2,f_int1); |
| 65 |
--source suite/parts/inc/partition_alter_11.inc |
| 66 |
|
| 67 |
|