diff options
author | Georgi Kodinov <joro@sun.com> | 2009-09-18 16:01:18 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-09-18 16:01:18 +0300 |
commit | 01e5bc703d91e5d39b9f00b8eb31d563a2cf6b40 (patch) | |
tree | 5ec69f44c0fb8391a6b8b9e19ab20bf83cec6aba /sql | |
parent | 64badb5f269850d0111aec29788aff7e181c195d (diff) | |
download | mariadb-git-01e5bc703d91e5d39b9f00b8eb31d563a2cf6b40.tar.gz |
Bug#46760: Fast ALTER TABLE no longer works for InnoDB
Despite copying the value of the old table's row type
we don't always have to mark row type as being specified.
Innodb uses this to check if it can do fast ALTER TABLE
or not.
Fixed by correctly flagging the presence of row_type
only when it's actually changed.
Added a test case for 39200.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.h | 9 | ||||
-rw-r--r-- | sql/sql_table.cc | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h index f759239d66e..fe8f7c437ff 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -913,6 +913,15 @@ typedef struct st_ha_create_information ulong key_block_size; SQL_LIST merge_list; handlerton *db_type; + /** + Row type of the table definition. + + Defaults to ROW_TYPE_DEFAULT for all non-ALTER statements. + For ALTER TABLE defaults to ROW_TYPE_NOT_USED (means "keep the current"). + + Can be changed either explicitly by the parser. + If nothing speficied inherits the value of the original table (if present). + */ enum row_type row_type; uint null_bits; /* NULL bits at start of record */ uint options; /* OR of HA_CREATE_ options */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 41e76211dd8..9d929c0d1a3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6656,9 +6656,19 @@ view_err: goto err; } + /* + If this is an ALTER TABLE and no explicit row type specified reuse + the table's row type. + Note : this is the same as if the row type was specified explicitly. + */ if (create_info->row_type == ROW_TYPE_NOT_USED) { + /* ALTER TABLE without explicit row type */ create_info->row_type= table->s->row_type; + } + else + { + /* ALTER TABLE with specific row type */ create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT; } |