MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
detect derived tables differently. TABLE_LIST::is_derived() only works after mysql_derived_init()
This commit is contained in:
parent
79fd338e6c
commit
4fa44c584c
@ -229,3 +229,37 @@ drop user definer@localhost;
|
||||
drop database mysqltest1;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
#
|
||||
# MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
|
||||
#
|
||||
create user u1@localhost;
|
||||
grant all privileges on test.* to u1@localhost;
|
||||
connect con1,localhost,u1;
|
||||
use test;
|
||||
create table t1 (id int not null);
|
||||
create view v1 as select * from (select * from t1) dt;
|
||||
lock table v1 read;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`u1`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `dt`.`id` AS `id` from (select `test`.`t1`.`id` AS `id` from `test`.`t1`) `dt` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop user u1@localhost;
|
||||
|
@ -75,3 +75,20 @@ drop user definer@localhost;
|
||||
drop database mysqltest1;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
|
||||
--echo #
|
||||
create user u1@localhost;
|
||||
grant all privileges on test.* to u1@localhost;
|
||||
connect con1,localhost,u1;
|
||||
use test;
|
||||
create table t1 (id int not null);
|
||||
create view v1 as select * from (select * from t1) dt;
|
||||
lock table v1 read;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
exec $MYSQL_DUMP test v1 -uu1 --compact;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop user u1@localhost;
|
||||
|
@ -6639,7 +6639,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
|
||||
bool check_single_table_access(THD *thd, ulong privilege, TABLE_LIST *tables,
|
||||
bool no_errors)
|
||||
{
|
||||
if (tables->is_derived())
|
||||
if (tables->derived)
|
||||
return 0;
|
||||
|
||||
Switch_to_definer_security_ctx backup_sctx(thd, tables);
|
||||
|
Loading…
x
Reference in New Issue
Block a user