mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
bug #31231 mysql_alter_table() tries to drop a non-existing table
bug#31233 mysql_alter_table() fails to drop UNIQUE KEY mysql-test/suite/ndb/r/ndb_alter_table.result: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: added test cases mysql-test/suite/ndb/t/ndb_alter_table.test: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: added test cases sql/ha_ndbcluster.cc: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: Removed check for non-pk tables, not needed when mysql_alter_table checks apropriate flags sql/mysql_priv.h: bug #31231 mysql_alter_table() tries to drop a non-existing table: added FRM_ONLY flag sql/sql_table.cc: bug #31231 mysql_alter_table() tries to drop a non-existing table Don't invoke handler for tables defined with FRM_ONLY flag. bug#31233 mysql_alter_table() fails to drop UNIQUE KEY When a table is defined without an explicit primary key mysql will choose the first found unique index defined over non-nullable fields (if such an index exists). This means that if such an index is added (the first) or dropped (the last) through an alter table, this equals adding or dropping a primary key. The implementation for on-line add/drop index did not consider this semantics. This patch ensures that only handlers with the correctly defined flags (see handler.h for explanation of the flags): HA_ONLINE_ADD_PK_INDEX HA_ONLINE_ADD_PK_INDEX_NO_WRITES HA_ONLINE_DROP_PK_INDEX HA_ONLINE_DROP_PK_INDEX_NO_WRITES are invoked for such on-line operations. All others handlers must perform a full (offline) alter table.
This commit is contained in:
parent
30849acf47
commit
08421a83ba
5 changed files with 185 additions and 54 deletions
|
|
@ -9971,34 +9971,23 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
|
|||
if (table_changes != IS_EQUAL_YES)
|
||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||
|
||||
/**
|
||||
* Changing from/to primary key
|
||||
*
|
||||
* This is _not_ correct, but check_if_incompatible_data-interface
|
||||
* doesnt give more info, so I guess that we can't do any
|
||||
* online add index if not using primary key
|
||||
*
|
||||
* This as mysql will handle a unique not null index as primary
|
||||
* even wo/ user specifiying it... :-(
|
||||
*
|
||||
*/
|
||||
if ((table_share->primary_key == MAX_KEY && pk) ||
|
||||
(table_share->primary_key != MAX_KEY && !pk) ||
|
||||
(table_share->primary_key == MAX_KEY && !pk && ai))
|
||||
{
|
||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||
}
|
||||
|
||||
/* Check that auto_increment value was not changed */
|
||||
if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
|
||||
create_info->auto_increment_value != 0)
|
||||
{
|
||||
DBUG_PRINT("info", ("auto_increment value changed"));
|
||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||
}
|
||||
|
||||
/* Check that row format didn't change */
|
||||
if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
|
||||
get_row_type() != create_info->row_type)
|
||||
{
|
||||
DBUG_PRINT("info", ("row format changed"));
|
||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("new table seems compatible"));
|
||||
DBUG_RETURN(COMPATIBLE_DATA_YES);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue