mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE
* be strict in CREATE TABLE, just like in ALTER TABLE, because CREATE TABLE, just like ALTER TABLE, can be rolled back for any engine * but don't auto-convert warnings into errors for engine warnings (handler::create) - this matches ALTER TABLE behavior * and not when creating a default record, these errors are handled specially (and replaced with ER_INVALID_DEFAULT) * always issue a Note when a non-unique key is truncated, because it's not a Warning that can be converted to an Error. Before this commit it was a Note for blobs and a Warning for all other data types.
This commit is contained in:
@ -3983,8 +3983,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
{
|
||||
/* not a critical problem */
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_TOO_LONG_KEY,
|
||||
ER_THD(thd, ER_TOO_LONG_KEY),
|
||||
ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY),
|
||||
key_part_length);
|
||||
/* Align key length to multibyte char boundary */
|
||||
key_part_length-= key_part_length % sql_field->charset->mbmaxlen;
|
||||
@ -4030,7 +4029,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
if (key->type == Key::MULTIPLE)
|
||||
{
|
||||
/* not a critical problem */
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY),
|
||||
key_part_length);
|
||||
/* Align key length to multibyte char boundary */
|
||||
@ -5133,6 +5132,9 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
|
||||
if (!opt_explicit_defaults_for_timestamp)
|
||||
promote_first_timestamp_column(&alter_info->create_list);
|
||||
|
||||
/* We can abort create table for any table type */
|
||||
thd->abort_on_warning= thd->is_strict_mode();
|
||||
|
||||
if (mysql_create_table_no_lock(thd, db, table_name, create_info, alter_info,
|
||||
&is_trans, create_table_mode) > 0)
|
||||
{
|
||||
@ -5165,6 +5167,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
|
||||
}
|
||||
|
||||
err:
|
||||
thd->abort_on_warning= 0;
|
||||
|
||||
/* In RBR we don't need to log CREATE TEMPORARY TABLE */
|
||||
if (!result && thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
|
||||
DBUG_RETURN(result);
|
||||
|
Reference in New Issue
Block a user