mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@ -4331,6 +4331,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
|
||||
if (thd->variables.sql_mode & MODE_NO_ZERO_DATE &&
|
||||
!sql_field->default_value && !sql_field->vcol_info &&
|
||||
!sql_field->vers_sys_field() &&
|
||||
sql_field->is_timestamp_type() &&
|
||||
!opt_explicit_defaults_for_timestamp &&
|
||||
(sql_field->flags & NOT_NULL_FLAG) &&
|
||||
@ -4470,6 +4471,21 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
|
||||
Well_formed_prefix(system_charset_info, *comment, max_len).length();
|
||||
if (tmp_len < comment->length)
|
||||
{
|
||||
if (comment->length <= max_len)
|
||||
{
|
||||
if (thd->is_strict_mode())
|
||||
{
|
||||
my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
|
||||
system_charset_info->csname, comment->str);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_INVALID_CHARACTER_STRING,
|
||||
ER_THD(thd, ER_INVALID_CHARACTER_STRING),
|
||||
system_charset_info->csname, comment->str);
|
||||
comment->length= tmp_len;
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
if (thd->is_strict_mode())
|
||||
{
|
||||
my_error(err_code, MYF(0), name, static_cast<ulong>(max_len));
|
||||
@ -8056,16 +8072,13 @@ blob_length_by_type(enum_field_types type)
|
||||
}
|
||||
|
||||
|
||||
static void append_drop_column(THD *thd, bool dont, String *str,
|
||||
Field *field)
|
||||
static inline
|
||||
void append_drop_column(THD *thd, String *str, Field *field)
|
||||
{
|
||||
if (!dont)
|
||||
{
|
||||
if (str->length())
|
||||
str->append(STRING_WITH_LEN(", "));
|
||||
str->append(STRING_WITH_LEN("DROP COLUMN "));
|
||||
append_identifier(thd, str, &field->field_name);
|
||||
}
|
||||
if (str->length())
|
||||
str->append(STRING_WITH_LEN(", "));
|
||||
str->append(STRING_WITH_LEN("DROP COLUMN "));
|
||||
append_identifier(thd, str, &field->field_name);
|
||||
}
|
||||
|
||||
|
||||
@ -8310,7 +8323,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
field->invisible < INVISIBLE_SYSTEM)
|
||||
{
|
||||
StringBuffer<NAME_LEN*3> tmp;
|
||||
append_drop_column(thd, false, &tmp, field);
|
||||
append_drop_column(thd, &tmp, field);
|
||||
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
|
||||
goto err;
|
||||
}
|
||||
@ -8406,7 +8419,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
field->default_value->expr->walk(&Item::rename_fields_processor, 1,
|
||||
&column_rename_param);
|
||||
}
|
||||
table->m_needs_reopen= 1; // because new column name is on thd->mem_root
|
||||
// Force reopen because new column name is on thd->mem_root
|
||||
table->mark_table_for_reopen();
|
||||
}
|
||||
|
||||
dropped_sys_vers_fields &= VERS_SYSTEM_FIELD;
|
||||
@ -8416,10 +8430,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
!vers_system_invisible)
|
||||
{
|
||||
StringBuffer<NAME_LEN*3> tmp;
|
||||
append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_START_FLAG,
|
||||
&tmp, table->vers_start_field());
|
||||
append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_END_FLAG,
|
||||
&tmp, table->vers_end_field());
|
||||
if (!(dropped_sys_vers_fields & VERS_SYS_START_FLAG))
|
||||
append_drop_column(thd, &tmp, table->vers_start_field());
|
||||
if (!(dropped_sys_vers_fields & VERS_SYS_END_FLAG))
|
||||
append_drop_column(thd, &tmp, table->vers_end_field());
|
||||
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
|
||||
goto err;
|
||||
}
|
||||
@ -8905,7 +8919,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
{
|
||||
check->expr->walk(&Item::rename_fields_processor, 1,
|
||||
&column_rename_param);
|
||||
table->m_needs_reopen= 1; // because new column name is on thd->mem_root
|
||||
// Force reopen because new column name is on thd->mem_root
|
||||
table->mark_table_for_reopen();
|
||||
}
|
||||
new_constraint_list.push_back(check, thd->mem_root);
|
||||
}
|
||||
|
Reference in New Issue
Block a user