~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/t/skip_grants.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This tests not performed with embedded server
 
2
-- source include/not_embedded.inc
 
3
 
 
4
use test;
 
5
 
 
6
#
 
7
# BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
 
8
# specified
 
9
#
 
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
 
16
#
 
17
 
 
18
# Prepare.
 
19
 
 
20
--disable_warnings
 
21
 
 
22
DROP VIEW IF EXISTS v1;
 
23
DROP VIEW IF EXISTS v2;
 
24
DROP VIEW IF EXISTS v3;
 
25
 
 
26
DROP TABLE IF EXISTS t1;
 
27
 
 
28
DROP PROCEDURE IF EXISTS p1;
 
29
DROP PROCEDURE IF EXISTS p2;
 
30
DROP PROCEDURE IF EXISTS p3;
 
31
 
 
32
DROP FUNCTION IF EXISTS f1;
 
33
DROP FUNCTION IF EXISTS f2;
 
34
DROP FUNCTION IF EXISTS f3;
 
35
 
 
36
--enable_warnings
 
37
 
 
38
# Test case.
 
39
 
 
40
CREATE TABLE t1(c INT);
 
41
 
 
42
# - try to create with implicit definer (definer would be ''@'');
 
43
 
 
44
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
 
45
  FOR EACH ROW
 
46
    SET @a = 1;
 
47
 
 
48
CREATE VIEW v1 AS SELECT * FROM t1;
 
49
 
 
50
CREATE PROCEDURE p1()
 
51
  SELECT 1;
 
52
 
 
53
CREATE FUNCTION f1() RETURNS INT
 
54
  RETURN 1;
 
55
 
 
56
# - try to create with explicit definer;
 
57
 
 
58
CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
 
59
  FOR EACH ROW
 
60
    SET @b = 1;
 
61
 
 
62
CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
 
63
 
 
64
CREATE DEFINER=a@b PROCEDURE p2()
 
65
  SELECT 2;
 
66
 
 
67
CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
 
68
  RETURN 2;
 
69
 
 
70
# - try to create with explicit definer with empty host;
 
71
 
 
72
CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
 
73
  FOR EACH ROW
 
74
    SET @c = 1;
 
75
 
 
76
CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
 
77
 
 
78
CREATE DEFINER=a@'' PROCEDURE p3()
 
79
  SELECT 3;
 
80
 
 
81
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
 
82
  RETURN 3;
 
83
 
 
84
# - check that empty host name is treated correctly;
 
85
 
 
86
SHOW CREATE VIEW v3;
 
87
 
 
88
SHOW CREATE PROCEDURE p3;
 
89
 
 
90
SHOW CREATE FUNCTION f3;
 
91
 
 
92
# Cleanup.
 
93
 
 
94
DROP TRIGGER t1_bi;
 
95
DROP TRIGGER ti_ai;
 
96
DROP TRIGGER ti_bu;
 
97
 
 
98
DROP VIEW v1;
 
99
DROP VIEW v2;
 
100
DROP VIEW v3;
 
101
 
 
102
DROP TABLE t1;
 
103
 
 
104
DROP PROCEDURE p1;
 
105
DROP PROCEDURE p2;
 
106
DROP PROCEDURE p3;
 
107
 
 
108
DROP FUNCTION f1;
 
109
DROP FUNCTION f2;
 
110
DROP FUNCTION f3;
 
111
 
 
112
#
 
113
# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
 
114
#
 
115
--error ER_OPTION_PREVENTS_STATEMENT
 
116
set global event_scheduler=1;
 
117
 
 
118
#
 
119
# Bug#26285 Selecting information_schema crahes server
 
120
#
 
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
 
126
 
 
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);
 
133
 
 
134
--echo End of 5.1 tests