diff --git a/go/logic/inspect.go b/go/logic/inspect.go index 23f238a..d2633de 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -596,10 +596,10 @@ func (this *Inspector) applyColumnTypes(databaseName, tableName string, columnsL // getAutoIncrementValue get's the original table's AUTO_INCREMENT value, if exists (0 value if not exists) func (this *Inspector) getAutoIncrementValue(tableName string) (autoIncrement uint64, err error) { query := ` - SELECT + SELECT AUTO_INCREMENT - FROM INFORMATION_SCHEMA.TABLES - WHERE + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLES.TABLE_SCHEMA = ? AND TABLES.TABLE_NAME = ? AND AUTO_INCREMENT IS NOT NULL diff --git a/localtests/autoinc-copy-deletes-user-defined/create.sql b/localtests/autoinc-copy-deletes-user-defined/create.sql new file mode 100644 index 0000000..2058b0b --- /dev/null +++ b/localtests/autoinc-copy-deletes-user-defined/create.sql @@ -0,0 +1,17 @@ +drop event if exists gh_ost_test; + +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + primary key(id) +) auto_increment=1; + +insert into gh_ost_test values (NULL, 11); +insert into gh_ost_test values (NULL, 13); +insert into gh_ost_test values (NULL, 17); +insert into gh_ost_test values (NULL, 23); +insert into gh_ost_test values (NULL, 29); +insert into gh_ost_test values (NULL, 31); +insert into gh_ost_test values (NULL, 37); +delete from gh_ost_test where id>=5; diff --git a/localtests/autoinc-copy-deletes-user-defined/expect_table_structure b/localtests/autoinc-copy-deletes-user-defined/expect_table_structure new file mode 100644 index 0000000..5e180af --- /dev/null +++ b/localtests/autoinc-copy-deletes-user-defined/expect_table_structure @@ -0,0 +1 @@ +AUTO_INCREMENT=7 diff --git a/localtests/autoinc-copy-deletes-user-defined/extra_args b/localtests/autoinc-copy-deletes-user-defined/extra_args new file mode 100644 index 0000000..cce91e1 --- /dev/null +++ b/localtests/autoinc-copy-deletes-user-defined/extra_args @@ -0,0 +1 @@ +--alter='AUTO_INCREMENT=7'