1use test;
2DROP VIEW IF EXISTS v1;
3DROP VIEW IF EXISTS v2;
4DROP VIEW IF EXISTS v3;
5DROP TABLE IF EXISTS t1;
6DROP PROCEDURE IF EXISTS p1;
7DROP PROCEDURE IF EXISTS p2;
8DROP PROCEDURE IF EXISTS p3;
9DROP FUNCTION IF EXISTS f1;
10DROP FUNCTION IF EXISTS f2;
11DROP FUNCTION IF EXISTS f3;
12CREATE TABLE t1(c INT);
13CREATE TRIGGER t1_bi BEFORE INSERT ON t1
14FOR EACH ROW
15SET @a = 1;
16CREATE VIEW v1 AS SELECT * FROM t1;
17CREATE PROCEDURE p1()
18SELECT 1;
19CREATE FUNCTION f1() RETURNS INT
20RETURN 1;
21CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
22FOR EACH ROW
23SET @b = 1;
24CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
25CREATE DEFINER=a@b PROCEDURE p2()
26SELECT 2;
27CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
28RETURN 2;
29CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
30FOR EACH ROW
31SET @c = 1;
32CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
33CREATE DEFINER=a@'' PROCEDURE p3()
34SELECT 3;
35CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
36RETURN 3;
37SHOW CREATE VIEW v3;
38View	Create View	character_set_client	collation_connection
39v3	CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1`	latin1	latin1_swedish_ci
40SHOW CREATE PROCEDURE p3;
41Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
42p3	NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`a`@`` PROCEDURE `p3`()
43SELECT 3	latin1	latin1_swedish_ci	latin1_swedish_ci
44SHOW CREATE FUNCTION f3;
45Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
46f3	NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11)
47RETURN 3	latin1	latin1_swedish_ci	latin1_swedish_ci
48DROP TRIGGER t1_bi;
49DROP TRIGGER ti_ai;
50DROP TRIGGER ti_bu;
51DROP VIEW v1;
52DROP VIEW v2;
53DROP VIEW v3;
54DROP TABLE t1;
55DROP PROCEDURE p1;
56DROP PROCEDURE p2;
57DROP PROCEDURE p3;
58DROP FUNCTION f1;
59DROP FUNCTION f2;
60DROP FUNCTION f3;
61set global event_scheduler=1;
62ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement
63select count(*) from information_schema.COLUMN_PRIVILEGES;
64count(*)
650
66select count(*) from information_schema.SCHEMA_PRIVILEGES;
67count(*)
680
69select count(*) from information_schema.TABLE_PRIVILEGES;
70count(*)
710
72select count(*) from information_schema.USER_PRIVILEGES;
73count(*)
740
75End of 5.0 tests
76#
77# Bug#29817 Queries with UDF fail with non-descriptive error
78# if mysql.proc is missing
79#
80select no_such_function(1);
81ERROR 42000: FUNCTION test.no_such_function does not exist
82End of 5.1 tests
83