MDEV-18241 Downgrade from 10.4 to 10.3 crashes

privilege tables can never be views or temporary tables,
don't even try to open them, if they are.
This commit is contained in:
Sergei Golubchik 2019-04-05 13:02:51 +02:00
parent 66099b8f2d
commit 822071ca5b
3 changed files with 30 additions and 0 deletions

View File

@ -121,3 +121,14 @@ View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
call mtr.add_suppression("Table 'mysql.user' doesn't exist");
rename table mysql.user to mysql.user1;
create view mysql.user as select * from mysql.user1;
flush privileges;
ERROR 42S02: Table 'mysql.user' doesn't exist
drop view mysql.user;
create temporary table mysql.user select * from mysql.user1 limit 0;
flush privileges;
ERROR 42S02: Table 'mysql.user' doesn't exist
drop temporary table mysql.user;
rename table mysql.user1 to mysql.user;

View File

@ -144,3 +144,18 @@ connection default;
disconnect con1;
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
#
# MDEV-18241 Downgrade from 10.4 to 10.3 crashes
#
call mtr.add_suppression("Table 'mysql.user' doesn't exist");
rename table mysql.user to mysql.user1;
create view mysql.user as select * from mysql.user1;
--error ER_NO_SUCH_TABLE
flush privileges;
drop view mysql.user;
create temporary table mysql.user select * from mysql.user1 limit 0;
--error ER_NO_SUCH_TABLE
flush privileges;
drop temporary table mysql.user;
rename table mysql.user1 to mysql.user;

View File

@ -1155,8 +1155,12 @@ static void fix_table_list(TABLE_LIST *tl, uint n)
TABLE_LIST *end;
for (end= tl + n - 1; tl < end; tl++)
{
tl->i_s_requested_object= OPEN_TABLE_ONLY;
tl->open_type= OT_BASE_ONLY;
tl->next_local= tl->next_global= tl + 1;
}
tl->i_s_requested_object= OPEN_TABLE_ONLY;
tl->open_type= OT_BASE_ONLY;
}