summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-07-22 17:55:05 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-07-22 17:55:05 +0300
commitefae374efa88ba7c1b2e970e4ef025272b09f2dd (patch)
treec26986d20a66bc1d514d1a574e17069f6139970e /storage
parent8ad6971a1adbb8d5a1f8d2c1bec96ac6a832345e (diff)
downloadmariadb-git-efae374efa88ba7c1b2e970e4ef025272b09f2dd.tar.gz
MDEV-26203 CREATE INDEX may enforce incorrect maximum column length
ha_innobase::prepare_inplace_alter_table(): Unless the table is being rebuilt, determine the maximum column length based on the current ROW_FORMAT of the table. When TABLE_SHARE (and the .frm file) contains no explicit ROW_FORMAT, InnoDB table creation or rebuild will use innodb_default_row_format. Based on mysql/mysql-server@3287d33acdc4260806a2a407ca15e9d1e04dddcb
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/handler0alter.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 3ac4f4fe4c1..24a7c4a74ad 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -5387,7 +5387,6 @@ ha_innobase::prepare_inplace_alter_table(
mem_heap_t* heap;
const char** col_names;
int error;
- ulint max_col_len;
ulint add_autoinc_col_no = ULINT_UNDEFINED;
ulonglong autoinc_col_max_value = 0;
ulint fts_doc_col_no = ULINT_UNDEFINED;
@@ -5601,7 +5600,13 @@ check_if_ok_to_rename:
& 1U << DICT_TF_POS_DATA_DIR);
}
- max_col_len = DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(info.flags());
+
+ /* ALGORITHM=INPLACE without rebuild (10.3+ ALGORITHM=NOCOPY)
+ must use the current ROW_FORMAT of the table. */
+ const ulint max_col_len = DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(
+ innobase_need_rebuild(ha_alter_info, this->table)
+ ? info.flags()
+ : m_prebuilt->table->flags);
/* Check each index's column length to make sure they do not
exceed limit */