mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / skip_grants.test
blob6f4d23e1e14e0bb78d5bb1ceb6969deb8956e57e
1 # This tests not performed with embedded server
2 -- source include/not_embedded.inc
4 use test;
7 # BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
8 # specified
10 # Also, the following test cases have been moved here:
11 #   - test that we can create VIEW if privileges check switched off has been
12 #     moved here;
13 #   - test that we can create and drop procedure without warnings (BUG#9993);
14 #   - BUG#17595: "DROP FUNCTION IF EXISTS" crashes server;
15 #   - BUG#13504: creation view with DEFINER clause if --skip-grant-tables
18 # Prepare.
20 --disable_warnings
22 DROP VIEW IF EXISTS v1;
23 DROP VIEW IF EXISTS v2;
24 DROP VIEW IF EXISTS v3;
26 DROP TABLE IF EXISTS t1;
28 DROP PROCEDURE IF EXISTS p1;
29 DROP PROCEDURE IF EXISTS p2;
30 DROP PROCEDURE IF EXISTS p3;
32 DROP FUNCTION IF EXISTS f1;
33 DROP FUNCTION IF EXISTS f2;
34 DROP FUNCTION IF EXISTS f3;
36 --enable_warnings
38 # Test case.
40 CREATE TABLE t1(c INT);
42 # - try to create with implicit definer (definer would be ''@'');
44 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
45   FOR EACH ROW
46     SET @a = 1;
48 CREATE VIEW v1 AS SELECT * FROM t1;
50 CREATE PROCEDURE p1()
51   SELECT 1;
53 CREATE FUNCTION f1() RETURNS INT
54   RETURN 1;
56 # - try to create with explicit definer;
58 CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
59   FOR EACH ROW
60     SET @b = 1;
62 CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
64 CREATE DEFINER=a@b PROCEDURE p2()
65   SELECT 2;
67 CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
68   RETURN 2;
70 # - try to create with explicit definer with empty host;
72 CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
73   FOR EACH ROW
74     SET @c = 1;
76 CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
78 CREATE DEFINER=a@'' PROCEDURE p3()
79   SELECT 3;
81 CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
82   RETURN 3;
84 # - check that empty host name is treated correctly;
86 SHOW CREATE VIEW v3;
88 SHOW CREATE PROCEDURE p3;
90 SHOW CREATE FUNCTION f3;
92 # Cleanup.
94 DROP TRIGGER t1_bi;
95 DROP TRIGGER ti_ai;
96 DROP TRIGGER ti_bu;
98 DROP VIEW v1;
99 DROP VIEW v2;
100 DROP VIEW v3;
102 DROP TABLE t1;
104 DROP PROCEDURE p1;
105 DROP PROCEDURE p2;
106 DROP PROCEDURE p3;
108 DROP FUNCTION f1;
109 DROP FUNCTION f2;
110 DROP FUNCTION f3;
113 # Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
115 --error ER_OPTION_PREVENTS_STATEMENT
116 set global event_scheduler=1;
119 # Bug#26285 Selecting information_schema crahes server
121 select count(*) from information_schema.COLUMN_PRIVILEGES;
122 select count(*) from information_schema.SCHEMA_PRIVILEGES;
123 select count(*) from information_schema.TABLE_PRIVILEGES;
124 select count(*) from information_schema.USER_PRIVILEGES;
125 --echo End of 5.0 tests
127 --echo #
128 --echo # Bug#29817 Queries with UDF fail with non-descriptive error
129 --echo # if mysql.proc is missing
130 --echo #
131 --error ER_SP_DOES_NOT_EXIST
132 select no_such_function(1);
134 --echo End of 5.1 tests