Commit b13f1cc5 authored by Eugene Kosov's avatar Eugene Kosov Committed by GitHub

MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION

parent 7eff2080
......@@ -422,5 +422,10 @@ create or replace table t(x int, y int) with system versioning engine=innodb;
alter table t modify y int without system versioning;
insert into t values(1, 1);
update t set y=2;
# MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION
create or replace table t1 (pk int auto_increment unique) with system versioning;
insert into t1 values (1);
delete from t1;
alter table t1 engine=myisam;
drop database test;
create database test;
......@@ -365,5 +365,11 @@ alter table t modify y int without system versioning;
insert into t values(1, 1);
update t set y=2;
--echo # MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION
create or replace table t1 (pk int auto_increment unique) with system versioning;
insert into t1 values (1);
delete from t1;
alter table t1 engine=myisam;
drop database test;
create database test;
......@@ -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())
{
......
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