mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge 10.1 into 10.2
This commit is contained in:
@ -7702,9 +7702,25 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
{
|
||||
if (def->change && ! def->field)
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change,
|
||||
table->s->table_name.str);
|
||||
goto err;
|
||||
/*
|
||||
Check if there is modify for newly added field.
|
||||
*/
|
||||
Create_field *find;
|
||||
find_it.rewind();
|
||||
while((find=find_it++))
|
||||
{
|
||||
if (!my_strcasecmp(system_charset_info,find->field_name, def->field_name))
|
||||
break;
|
||||
}
|
||||
|
||||
if (find && !find->field)
|
||||
find_it.remove();
|
||||
else
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change,
|
||||
table->s->table_name.str);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Check that the DATE/DATETIME not null field we are going to add is
|
||||
@ -7770,6 +7786,29 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
find_it.after(def); // Put column after this
|
||||
}
|
||||
}
|
||||
/*
|
||||
Check if there is alter for newly added field.
|
||||
*/
|
||||
alter_it.rewind();
|
||||
Alter_column *alter;
|
||||
while ((alter=alter_it++))
|
||||
{
|
||||
if (!my_strcasecmp(system_charset_info,def->field_name, alter->name))
|
||||
break;
|
||||
}
|
||||
if (alter)
|
||||
{
|
||||
if (def->sql_type == MYSQL_TYPE_BLOB)
|
||||
{
|
||||
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
|
||||
goto err;
|
||||
}
|
||||
if ((def->default_value= alter->default_value)) // Use new default
|
||||
def->flags&= ~NO_DEFAULT_VALUE_FLAG;
|
||||
else
|
||||
def->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
alter_it.remove();
|
||||
}
|
||||
}
|
||||
if (alter_info->alter_list.elements)
|
||||
{
|
||||
|
Reference in New Issue
Block a user