1use test;
2CREATE TABLE t1(c INT);
3CREATE TRIGGER t1_bi BEFORE INSERT ON t1
4FOR EACH ROW
5SET @a = 1;
6CREATE VIEW v1 AS SELECT * FROM t1;
7CREATE PROCEDURE p1()
8SELECT 1;
9CREATE FUNCTION f1() RETURNS INT
10RETURN 1;
11CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
12FOR EACH ROW
13SET @b = 1;
14CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
15CREATE DEFINER=a@b PROCEDURE p2()
16SELECT 2;
17CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
18RETURN 2;
19CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
20FOR EACH ROW
21SET @c = 1;
22CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
23CREATE DEFINER=a@'' PROCEDURE p3()
24SELECT 3;
25CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
26RETURN 3;
27SHOW CREATE VIEW v3;
28View	Create View	character_set_client	collation_connection
29v3	CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`%` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1`	latin1	latin1_swedish_ci
30SHOW CREATE PROCEDURE p3;
31Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
32p3	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`a`@`%` PROCEDURE `p3`()
33SELECT 3	latin1	latin1_swedish_ci	latin1_swedish_ci
34SHOW CREATE FUNCTION f3;
35Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
36f3	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11)
37RETURN 3	latin1	latin1_swedish_ci	latin1_swedish_ci
38DROP TRIGGER t1_bi;
39DROP TRIGGER ti_ai;
40DROP TRIGGER ti_bu;
41DROP VIEW v1;
42DROP VIEW v2;
43DROP VIEW v3;
44DROP TABLE t1;
45DROP PROCEDURE p1;
46DROP PROCEDURE p2;
47DROP PROCEDURE p3;
48DROP FUNCTION f1;
49DROP FUNCTION f2;
50DROP FUNCTION f3;
51#
52# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
53#
54set global event_scheduler=1;
55Warnings:
56Note	1408	Event Scheduler: Loaded 0 events
57set global event_scheduler=0;
58#
59# Bug#26285 Selecting information_schema crahes server
60#
61select count(*) from information_schema.COLUMN_PRIVILEGES;
62count(*)
630
64select count(*) from information_schema.SCHEMA_PRIVILEGES;
65count(*)
660
67select count(*) from information_schema.TABLE_PRIVILEGES;
68count(*)
690
70select count(*) from information_schema.USER_PRIVILEGES;
71count(*)
720
73#
74# End of 5.0 tests
75#
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
82#
83# End of 5.1 tests
84#
85#
86# MDEV-8280 crash in 'show global status' with --skip-grant-tables
87#
88show global status like 'Acl%';
89Variable_name	Value
90Acl_column_grants	0
91Acl_database_grants	0
92Acl_function_grants	0
93Acl_procedure_grants	0
94Acl_package_spec_grants	0
95Acl_package_body_grants	0
96Acl_proxy_users	0
97Acl_role_grants	0
98Acl_roles	0
99Acl_table_grants	0
100Acl_users	0
101#
102# End of 10.1 tests
103#
104#
105# MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
106#
107set role x;
108ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
109#
110# End of 10.2 tests
111#
112show create user root@localhost;
113ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
114insert mysql.global_priv values ('foo', 'bar', '{}');
115insert mysql.global_priv values ('baz', 'baz', '{"plugin":"baz"}');
116set password for bar@foo = password("pass word");
117ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
118flush privileges;
119show create user root@localhost;
120CREATE USER for root@localhost
121CREATE USER `root`@`localhost`
122show create user bar@foo;
123CREATE USER for bar@foo
124CREATE USER `bar`@`foo`
125show create user baz@baz;
126CREATE USER for baz@baz
127CREATE USER `baz`@`baz` IDENTIFIED VIA baz
128set password for bar@foo = password("pass word");
129show create user bar@foo;
130CREATE USER for bar@foo
131CREATE USER `bar`@`foo` IDENTIFIED BY PASSWORD '*EDBBEA7F4E7B5D8B0BC8D7AC5D1936FB7DA10611'
132alter user baz@baz identified with mysql_native_password as password("baz");
133show create user baz@baz;
134CREATE USER for baz@baz
135CREATE USER `baz`@`baz` IDENTIFIED BY PASSWORD '*E52096EF8EB0240275A7FE9E069101C33F98CF07'
136drop user bar@foo;
137drop user baz@baz;
138# restart
139#
140# End of 10.3 tests
141#
142