diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-12 10:25:34 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-12 10:30:01 +0300 |
commit | 4bbd8be482929984b9dceb077187d0fdbbcde4f0 (patch) | |
tree | 64e98c1390baa3c35f3a18845ef4155fc3092ac1 /sql/table.cc | |
parent | 34b38ad726025b3ede5db0f5b7dfaaafc8d1e754 (diff) | |
parent | b2f76bac035b62899207d443c48da8cd614cd05b (diff) | |
download | mariadb-git-4bbd8be482929984b9dceb077187d0fdbbcde4f0.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc index c54f09bf760..7bc3a507bd8 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1357,8 +1357,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, } if (!share->table_charset) { + const CHARSET_INFO *cs= thd->variables.collation_database; /* unknown charset in frm_image[38] or pre-3.23 frm */ - if (use_mb(default_charset_info)) + if (use_mb(cs)) { /* Warn that we may be changing the size of character columns */ sql_print_warning("'%s' had no or invalid character set, " @@ -1366,7 +1367,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, "so character column sizes may have changed", share->path.str); } - share->table_charset= default_charset_info; + share->table_charset= cs; } share->db_record_offset= 1; @@ -2615,8 +2616,20 @@ static bool sql_unusable_for_discovery(THD *thd, handlerton *engine, if (create_info->data_file_name || create_info->index_file_name) return 1; // ... engine - if (create_info->db_type && create_info->db_type != engine) - return 1; + DBUG_ASSERT(lex->m_sql_cmd); + if (lex->create_info.used_fields & HA_CREATE_USED_ENGINE) + { + /* + TODO: we could just compare engine names here, without resolving. + But this optimization is too late for 10.1. + */ + Storage_engine_name *opt= lex->m_sql_cmd->option_storage_engine_name(); + DBUG_ASSERT(opt); // lex->m_sql_cmd must be an Sql_cmd_create_table instance + if (opt->resolve_storage_engine_with_error(thd, &create_info->db_type, + false) || + (create_info->db_type && create_info->db_type != engine)) + return 1; + } return 0; } |