diff options
-rw-r--r-- | mysql-test/r/view.result | 22 | ||||
-rw-r--r-- | mysql-test/t/grant.test | 2 | ||||
-rw-r--r-- | mysql-test/t/view.test | 83 |
3 files changed, 55 insertions, 52 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index dba9a9e229e..f70547cd4a8 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2849,17 +2849,6 @@ SHOW TABLES; Tables_in_test t1 DROP TABLE t1; -DROP TABLE IF EXISTS t1; -DROP VIEW IF EXISTS v1; -DROP VIEW IF EXISTS v2; -CREATE TABLE t1(a INT, b INT); -CREATE DEFINER=1234567890abcdefGHIKL@localhost -VIEW v1 AS SELECT a FROM t1; -ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16) -CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY -VIEW v2 AS SELECT b FROM t1; -ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60) -DROP TABLE t1; DROP VIEW IF EXISTS v1; CREATE DATABASE bug21261DB; USE bug21261DB; @@ -2890,6 +2879,17 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) drop view v1; drop table t1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +CREATE TABLE t1(a INT, b INT); +CREATE DEFINER=1234567890abcdefGHIKL@localhost +VIEW v1 AS SELECT a FROM t1; +ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16) +CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY +VIEW v2 AS SELECT b FROM t1; +ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60) +DROP TABLE t1; DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; DROP VIEW IF EXISTS v1, v2; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index a938a8a64a7..d3781d58780 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -805,7 +805,7 @@ DROP DATABASE mysqltest3; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; DROP USER 'mysqltest_1'@'localhost'; -# eestore the original database +# restore the original database use test; # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 5ae4ec8bbfa..edff38274c4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2715,9 +2715,52 @@ DROP VIEW t1,v1; SHOW TABLES; DROP TABLE t1; +--disable_warnings +DROP VIEW IF EXISTS v1; +--enable_warnings + +# +# Bug #21261: Wrong access rights was required for an insert to a view +# +CREATE DATABASE bug21261DB; +USE bug21261DB; +CONNECT (root,localhost,root,,bug21261DB); +CONNECTION root; +CREATE TABLE t1 (x INT); +CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1; +GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost'; +GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost'; +CREATE TABLE t2 (y INT); +GRANT SELECT ON t2 TO 'user21261'@'localhost'; + +CONNECT (user21261, localhost, user21261,, bug21261DB); +CONNECTION user21261; +INSERT INTO v1 (x) VALUES (5); +UPDATE v1 SET x=1; +CONNECTION root; +GRANT SELECT ON v1 TO 'user21261'@'localhost'; +GRANT SELECT ON t1 TO 'user21261'@'localhost'; +CONNECTION user21261; +UPDATE v1,t2 SET x=1 WHERE x=y; +CONNECTION root; +SELECT * FROM t1; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost'; +DROP USER 'user21261'@'localhost'; +DROP VIEW v1; +DROP TABLE t1; +DROP DATABASE bug21261DB; +USE test; # +# Bug #15950: NOW() optimized away in VIEWs +# +create table t1 (f1 datetime); +create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; +show create view v1; +drop view v1; +drop table t1; +# # Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause. # @@ -2790,45 +2833,5 @@ DROP FUNCTION f2; DROP VIEW v1, v2; DROP TABLE t1; -# -# Bug #21261: Wrong access rights was required for an insert to a view -# -CREATE DATABASE bug21261DB; -USE bug21261DB; -CONNECT (root,localhost,root,,bug21261DB); -CONNECTION root; -CREATE TABLE t1 (x INT); -CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1; -GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost'; -GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost'; -CREATE TABLE t2 (y INT); -GRANT SELECT ON t2 TO 'user21261'@'localhost'; - -CONNECT (user21261, localhost, user21261,, bug21261DB); -CONNECTION user21261; -INSERT INTO v1 (x) VALUES (5); -UPDATE v1 SET x=1; -CONNECTION root; -GRANT SELECT ON v1 TO 'user21261'@'localhost'; -GRANT SELECT ON t1 TO 'user21261'@'localhost'; -CONNECTION user21261; -UPDATE v1,t2 SET x=1 WHERE x=y; -CONNECTION root; -SELECT * FROM t1; -REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost'; -DROP USER 'user21261'@'localhost'; -DROP VIEW v1; -DROP TABLE t1; -DROP DATABASE bug21261DB; -USE test; - -# -# Bug #15950: NOW() optimized away in VIEWs -# -create table t1 (f1 datetime); -create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; -show create view v1; -drop view v1; -drop table t1; --echo End of 5.0 tests. |