summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2008-10-10 20:12:38 +0200
committerMattias Jonsson <mattias.jonsson@sun.com>2008-10-10 20:12:38 +0200
commitc6115db4c3a693dfed25e8e60e8ff5d06ba72756 (patch)
tree3dedd41f3a0163a4465388811c0aebd2d1b6fbf3 /sql/sql_partition.cc
parentb6704027d681a80be03d416e9c9c344d86a562dd (diff)
downloadmariadb-git-c6115db4c3a693dfed25e8e60e8ff5d06ba72756.tar.gz
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table Problem was that partitioning specific commands was accepted for non partitioned tables and treated like ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed, which changed the code path from mysql_alter_table to mysql_admin_table. Solution was to check if the table was partitioned before trying to execute the admin command mysql-test/r/partition_mgm_err.result: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Updated test result mysql-test/t/partition_mgm_err.test: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Updated test case sql/ha_partition.cc: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. sql/ha_partition.h: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. sql/sql_lex.h: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and added ALTER_ADMIN_PARTITION instead. sql/sql_partition.cc: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and added ALTER_ADMIN_PARTITION instead. sql/sql_table.cc: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Give error and return if trying partitioning admin command on non partitioned table. Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and added ALTER_ADMIN_PARTITION instead. sql/sql_yacc.yy: Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table Simplified the code by using ALTER_ADMIN_PARTITION for all commands that go through mysql_admin_tables and is set for partitioning specific commands that. Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and added ALTER_ADMIN_PARTITION instead.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc26
1 files changed, 6 insertions, 20 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index a45664a9767..4691d24285b 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4195,12 +4195,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
!(thd->work_part_info= thd->lex->part_info->get_clone()))
DBUG_RETURN(TRUE);
+ /* ALTER_ADMIN_PARTITION is handled in mysql_admin_table */
+ DBUG_ASSERT(!(alter_info->flags & ALTER_ADMIN_PARTITION));
+
if (alter_info->flags &
(ALTER_ADD_PARTITION | ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION |
- ALTER_TABLE_REORG | ALTER_OPTIMIZE_PARTITION |
- ALTER_CHECK_PARTITION | ALTER_ANALYZE_PARTITION |
- ALTER_REPAIR_PARTITION | ALTER_REBUILD_PARTITION))
+ ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION))
{
partition_info *tab_part_info= table->part_info;
partition_info *alt_part_info= thd->work_part_info;
@@ -4592,11 +4593,7 @@ that are reorganised.
}
tab_part_info->no_parts-= no_parts_dropped;
}
- else if ((alter_info->flags & ALTER_OPTIMIZE_PARTITION) ||
- (alter_info->flags & ALTER_ANALYZE_PARTITION) ||
- (alter_info->flags & ALTER_CHECK_PARTITION) ||
- (alter_info->flags & ALTER_REPAIR_PARTITION) ||
- (alter_info->flags & ALTER_REBUILD_PARTITION))
+ else if (alter_info->flags & ALTER_REBUILD_PARTITION)
{
uint no_parts_found;
uint no_parts_opt= alter_info->partition_names.elements;
@@ -4604,18 +4601,7 @@ that are reorganised.
if (no_parts_found != no_parts_opt &&
(!(alter_info->flags & ALTER_ALL_PARTITION)))
{
- const char *ptr;
- if (alter_info->flags & ALTER_OPTIMIZE_PARTITION)
- ptr= "OPTIMIZE";
- else if (alter_info->flags & ALTER_ANALYZE_PARTITION)
- ptr= "ANALYZE";
- else if (alter_info->flags & ALTER_CHECK_PARTITION)
- ptr= "CHECK";
- else if (alter_info->flags & ALTER_REPAIR_PARTITION)
- ptr= "REPAIR";
- else
- ptr= "REBUILD";
- my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), ptr);
+ my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD");
DBUG_RETURN(TRUE);
}
if (!(*fast_alter_partition))