diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 29337decb5e4b89e4c1b71d9b41fd37b25c9c254..5118c611bde6e06bde7086df45c67229a0d4873e 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -439,3 +439,9 @@ v call px5()// v 9 +create table t1 (a int not null auto_increment,b int, primary key (a)); +insert into t1 values (1,1),(NULL,3),(NULL,4); +select AUTO_INCREMENT from information_schema.tables where table_name = 't1'; +AUTO_INCREMENT +4 +drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index fb1d15dbb4cdf3b73c0d824d2bb46e5ff8b3e6a5..b44ddf46424c1d09a719c09e5cc32c1f6c31be4b 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -218,7 +218,8 @@ call px5()// call px5()// delimiter ;// - - - +create table t1 (a int not null auto_increment,b int, primary key (a)); +insert into t1 values (1,1),(NULL,3),(NULL,4); +select AUTO_INCREMENT from information_schema.tables where table_name = 't1'; +drop table t1; \ No newline at end of file diff --git a/sql/sql_show.cc b/sql/sql_show.cc index bda4fa08ed138da7cfee141726fea8f450a29894..c4b98cc4d6c8db6d88ea2eaff9aabe7412148301 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2116,7 +2116,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, } table->field[11]->store((longlong) file->index_file_length); table->field[12]->store((longlong) file->delete_length); - if (table->found_next_number_field) + if (show_table->found_next_number_field) { show_table->next_number_field=show_table->found_next_number_field; show_table->next_number_field->reset(); @@ -2196,12 +2196,16 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, table->field[19]->store(option_buff+1, (ptr == option_buff ? 0 : (uint) (ptr-option_buff)-1), cs); - - char *comment= show_table->file-> - update_table_comment(show_table->comment); - table->field[20]->store(comment, strlen(comment), cs); - if (comment != show_table->comment) - my_free(comment,MYF(0)); + { + char *comment= show_table->file-> + update_table_comment(show_table->comment); + if (comment) + { + table->field[20]->store(comment, strlen(comment), cs); + if (comment != show_table->comment) + my_free(comment,MYF(0)); + } + } } table->file->write_row(table->record[0]); DBUG_RETURN(0);