1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION

This commit is contained in:
Eugene Kosov
2017-12-20 16:41:42 +03:00
committed by GitHub
parent 7eff2080fd
commit b13f1cc59a
3 changed files with 31 additions and 2 deletions

View File

@ -3046,6 +3046,25 @@ 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;
@ -3056,8 +3075,7 @@ int handler::update_auto_increment()
enum enum_check_fields save_count_cuted_fields;
DBUG_ENTER("handler::update_auto_increment");
// ALTER TABLE ... ADD COLUMN ... AUTO_INCREMENT
if (thd->lex->sql_command == SQLCOM_ALTER_TABLE)
if (thd->lex->sql_command == SQLCOM_ALTER_TABLE && is_add_auto_increment(thd))
{
if (table->versioned())
{