diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index c301953f508..133fb5600bf 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -469,6 +469,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop database mysqltest; drop view if exists v1; +drop table if exists t1; create table t1 as select * from mysql.user where user=''; delete from mysql.user where user=''; flush privileges; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 5c600f05f12..f337bcdaf89 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3468,6 +3468,38 @@ set @@sql_mode=@old_mode; drop view v1; drop table t1; +########################################################################### + +--echo # ----------------------------------------------------------------- +--echo # -- Bug#34337: Server crash when Altering a view using a table name. +--echo # ----------------------------------------------------------------- +--echo + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--echo + +CREATE TABLE t1(c1 INT); + +--echo + +SELECT * FROM t1; + +--error ER_WRONG_OBJECT +ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1); + +--echo + +DROP TABLE t1; + +--echo +--echo # -- End of test case for Bug#34337. +--echo + +########################################################################### + --echo # ----------------------------------------------------------------- --echo # -- End of 5.0 tests. --echo # ----------------------------------------------------------------- @@ -3624,34 +3656,6 @@ drop procedure p; ########################################################################### ---echo # ----------------------------------------------------------------- ---echo # -- Bug#34337: Server crash when Altering a view using a table name. ---echo # ----------------------------------------------------------------- ---echo - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - ---echo - -CREATE TABLE t1(c1 INT); - ---echo - ---error ER_WRONG_OBJECT -ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1); - ---echo - -DROP TABLE t1; - ---echo ---echo # -- End of test case for Bug#34337. ---echo - -########################################################################### - --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 3be0148f765..cbc66300173 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -614,6 +614,7 @@ drop database mysqltest; # --disable_warnings drop view if exists v1; +drop table if exists t1; --enable_warnings # Backup anonymous users and remove them. (They get in the way of