Commit 64749432 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Eugene Kosov

Revert "MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION", fix differently

This reverts commit b13f1cc5

Don't scan the list of added columns for every row
in copy_data_between tables.
parent e65a695f
......@@ -3177,25 +3177,6 @@ prev_insert_id(ulonglong nr, struct system_variables *variables)
#define AUTO_INC_DEFAULT_NB_MAX_BITS 16
#define AUTO_INC_DEFAULT_NB_MAX ((1 << AUTO_INC_DEFAULT_NB_MAX_BITS) - 1)
// check for ADD COLUMN ... AUTO_INCREMENT query
static bool is_add_auto_increment(THD *thd)
{
DBUG_ASSERT(thd->lex->sql_command == SQLCOM_ALTER_TABLE);
bool add_auto_inc= false;
List_iterator_fast<Create_field> it(thd->lex->alter_info.create_list);
while (Create_field *f= it++)
{
if (f->flags & AUTO_INCREMENT_FLAG)
{
add_auto_inc= true;
break;
}
}
return add_auto_inc;
}
int handler::update_auto_increment()
{
ulonglong nr, nb_reserved_values;
......@@ -3206,24 +3187,6 @@ int handler::update_auto_increment()
enum enum_check_fields save_count_cuted_fields;
DBUG_ENTER("handler::update_auto_increment");
if (thd->lex->sql_command == SQLCOM_ALTER_TABLE && is_add_auto_increment(thd))
{
if (table->versioned())
{
Field *end= table->vers_end_field();
DBUG_ASSERT(end);
bitmap_set_bit(table->read_set, end->field_index);
if (!end->is_max())
{
if (!table->next_number_field->real_maybe_null())
DBUG_RETURN(HA_ERR_UNSUPPORTED);
table->next_number_field->set_null();
DBUG_RETURN(0);
}
}
table->next_number_field->set_notnull();
}
/*
next_insert_id is a "cursor" into the reserved interval, it may go greater
than the interval, but not smaller.
......@@ -3247,6 +3210,25 @@ int handler::update_auto_increment()
DBUG_RETURN(0);
}
// ALTER TABLE ... ADD COLUMN ... AUTO_INCREMENT
if (thd->lex->sql_command == SQLCOM_ALTER_TABLE)
{
if (table->versioned())
{
Field *end= table->vers_end_field();
DBUG_ASSERT(end);
bitmap_set_bit(table->read_set, end->field_index);
if (!end->is_max())
{
if (!table->next_number_field->real_maybe_null())
DBUG_RETURN(HA_ERR_UNSUPPORTED);
table->next_number_field->set_null();
DBUG_RETURN(0);
}
}
table->next_number_field->set_notnull();
}
if ((nr= next_insert_id) >= auto_inc_interval_for_cur_row.maximum())
{
/* next_insert_id is beyond what is reserved, so we reserve more. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment