MDEV-32919 Cannot select particular field from IS.tables in case table needs upgrade from MySQL 5.7

use the same condition in
fill_schema_table_from_frm() when open_table_from_share() fails, as in
fill_schema_table_from_frm() when tdc_aquire_share() fails and as in
fill_schema_table_from_open() when open_table_from_share() fails
This commit is contained in:
Sergei Golubchik 2024-11-16 18:17:08 +01:00
parent cc99a41502
commit deb20fb751
3 changed files with 22 additions and 3 deletions

View file

@ -20,6 +20,15 @@ show create table tempty;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
select * from tempty;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
select table_name, table_comment from information_schema.tables where table_schema='test' and table_comment!='VIEW';
table_name table_comment
mysql_json_test Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
mysql_json_test_big Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
tempty Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
Warnings:
Warning 1707 Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
Warning 1707 Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
Warning 1707 Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
alter table tempty force;
show create table tempty;
Table Create Table

View file

@ -43,6 +43,9 @@ show create table tempty;
--error ER_TABLE_NEEDS_REBUILD
select * from tempty;
--sorted_result
select table_name, table_comment from information_schema.tables where table_schema='test' and table_comment!='VIEW';
alter table tempty force;
show create table tempty;

View file

@ -5078,10 +5078,17 @@ static int fill_schema_table_from_frm(THD *thd, MEM_ROOT *mem_root,
goto end_share;
}
if (!open_table_from_share(thd, share, table_name, 0,
(EXTRA_RECORD | OPEN_FRM_FILE_ONLY),
thd->open_options, &tbl, FALSE))
res= open_table_from_share(thd, share, table_name, 0,
EXTRA_RECORD | OPEN_FRM_FILE_ONLY,
thd->open_options, &tbl, FALSE);
if (res && hide_object_error(thd->get_stmt_da()->sql_errno()))
res= 0;
else
{
char buf[NAME_CHAR_LEN + 1];
if (unlikely(res))
get_table_engine_for_i_s(thd, buf, &table_list, db_name, table_name);
tbl.s= share;
table_list.table= &tbl;
table_list.view= (LEX*) share->is_view;