diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index c1dbb6c5dd6..f503b2f54e5 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8199,6 +8199,7 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, for (index= 0; index <= m_tot_parts; index++) part_inplace_ctx->handler_ctx_array[index]= NULL; + ha_alter_info->handler_flags |= Alter_inplace_info::ALTER_PARTITIONED; for (index= 0; index < m_tot_parts; index++) { enum_alter_inplace_result p_result= diff --git a/sql/handler.h b/sql/handler.h index 06c7f73e9a9..d67d7fb0888 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1790,6 +1790,9 @@ public: // Virtual columns changed static const HA_ALTER_FLAGS ALTER_COLUMN_VCOL = 1L << 30; + // ALTER TABLE for a partitioned table + static const HA_ALTER_FLAGS ALTER_PARTITIONED = 1L << 31; + /** Create options (like MAX_ROWS) for the new version of table. diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 6bc59018486..a2d107330ff 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -79,6 +79,7 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_DATA /** Operations for altering a table that InnoDB does not care about */ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_INPLACE_IGNORE = Alter_inplace_info::ALTER_COLUMN_DEFAULT + | Alter_inplace_info::ALTER_PARTITIONED | Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT | Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE | Alter_inplace_info::ALTER_RENAME; diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result index d4aac756ffa..573da53b378 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result +++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/ai_part.result @@ -13,13 +13,13 @@ foo CREATE TABLE `foo` ( /*!50100 PARTITION BY HASH (a) PARTITIONS 2 */ ALTER TABLE foo ADD KEY(b); +ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MariaDB version SHOW CREATE TABLE foo; Table Create Table foo CREATE TABLE `foo` ( `a` int(11) NOT NULL DEFAULT '0', `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`) + PRIMARY KEY (`a`) ) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib' /*!50100 PARTITION BY HASH (a) PARTITIONS 2 */ diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result index 26685013aa4..103b3c08939 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result +++ b/storage/tokudb/mysql-test/tokudb_alter_table/r/hcad_part.result @@ -12,12 +12,12 @@ foo CREATE TABLE `foo` ( /*!50100 PARTITION BY HASH (a) PARTITIONS 2 */ ALTER TABLE foo ADD COLUMN c INT; +ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MariaDB version SHOW CREATE TABLE foo; Table Create Table foo CREATE TABLE `foo` ( `a` int(11) NOT NULL DEFAULT '0', `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib' /*!50100 PARTITION BY HASH (a) diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/t/ai_part.test b/storage/tokudb/mysql-test/tokudb_alter_table/t/ai_part.test index a6b3f6b7b18..9454ab6f098 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/t/ai_part.test +++ b/storage/tokudb/mysql-test/tokudb_alter_table/t/ai_part.test @@ -8,6 +8,7 @@ SET SESSION tokudb_disable_slow_alter=1; CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2; INSERT INTO foo VALUES (1,0),(2,0); SHOW CREATE TABLE foo; +--error 1112 ALTER TABLE foo ADD KEY(b); SHOW CREATE TABLE foo; diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/t/hcad_part.test b/storage/tokudb/mysql-test/tokudb_alter_table/t/hcad_part.test index 4eaeb623f66..1ed490b9a25 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/t/hcad_part.test +++ b/storage/tokudb/mysql-test/tokudb_alter_table/t/hcad_part.test @@ -7,6 +7,7 @@ DROP TABLE IF EXISTS foo; SET SESSION tokudb_disable_slow_alter=1; CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2; SHOW CREATE TABLE foo; +--error 1112 ALTER TABLE foo ADD COLUMN c INT; SHOW CREATE TABLE foo; diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index f8d14797658..f004f830907 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -79,6 +79,7 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_DATA /** Operations for altering a table that InnoDB does not care about */ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_INPLACE_IGNORE = Alter_inplace_info::ALTER_COLUMN_DEFAULT + | Alter_inplace_info::ALTER_PARTITIONED | Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT | Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE | Alter_inplace_info::ALTER_RENAME;