summaryrefslogtreecommitdiff
path: root/mysql-test/suite/perfschema/t/dml_setup_actors.test
blob: e6c17de37dcf63f8275c5cea385530ecdf7931a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Tests for PERFORMANCE_SCHEMA

--source include/not_embedded.inc
--source include/have_perfschema.inc

--disable_warnings
drop table if exists test.setup_actors;
--enable_warnings

# Save the setup
create table test.setup_actors as
  select * from performance_schema.setup_actors;

# Inserting Duplicate values in the table should
# throw error
--error ER_DUP_KEY
insert into performance_schema.setup_actors
  values ('%','%','%','YES', 'YES');
--error ER_DUP_KEY
insert into performance_schema.setup_actors
  values ('%','%','%','NO', 'NO');

truncate table performance_schema.setup_actors;

select * from performance_schema.setup_actors;

select * from performance_schema.setup_actors
  where user = '%';

insert into performance_schema.setup_actors
  set user='Joe', host='localhost';

insert into performance_schema.setup_actors
  set user='Joe', host='%';

insert into performance_schema.setup_actors
  set user='%', host='server1';

insert into performance_schema.setup_actors
  set user='%', host='%';

# Insert with wrong value for ENABLED column
--error 1265
insert into performance_schema.setup_actors
  values ('localhost', 'user1', '%', 'NO%', 'NO');

# Insert with wrong value for HISTORY column
--error 1265
insert into performance_schema.setup_actors
  values ('localhost', 'user1', '%', 'NO', 'KO');

select * from performance_schema.setup_actors
  order by USER, HOST;

--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.setup_actors
  set user='ILLEGAL';

--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.setup_actors
  set host='ILLEGAL';

--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.setup_actors
  set role='ILLEGAL';

# update on ENABLED column is allowed
update performance_schema.setup_actors
  set ENABLED='YES';

# update on HISTORY column is allowed
update performance_schema.setup_actors
  set HISTORY='YES';

# update on ENABLED column with wrong values
#throws error
--error 1265
update performance_schema.setup_actors
  set ENABLED='';

--error 1265
update performance_schema.setup_actors
  set ENABLED='YESS';

--error 1265
update performance_schema.setup_actors
  set ENABLED='NO%';

--error ER_BAD_NULL_ERROR
update performance_schema.setup_actors
  set ENABLED=NULL;

--error 1265
update performance_schema.setup_actors
  set HISTORY='YESS';

--error 1265
update performance_schema.setup_actors
  set HISTORY='NO%';

--error ER_BAD_NULL_ERROR
update performance_schema.setup_actors
  set HISTORY=NULL;

select * from performance_schema.setup_actors
  order by USER, HOST;

delete from performance_schema.setup_actors
  where user = 'Joe' and host = 'localhost';

select * from performance_schema.setup_actors
  order by USER, HOST;

delete from performance_schema.setup_actors;

select * from performance_schema.setup_actors
  order by USER, HOST;

LOCK TABLES performance_schema.setup_actors READ;
UNLOCK TABLES;

LOCK TABLES performance_schema.setup_actors WRITE;
UNLOCK TABLES;

--echo #
--echo # WL#2284: Increase the length of a user name
--echo #

insert into performance_schema.setup_actors
  set user='user_name_len_22_01234', host='localhost';

delete from performance_schema.setup_actors
  where user = 'user_name_len_22_01234' and host = 'localhost';


# Restore the setup
truncate table performance_schema.setup_actors;
insert into performance_schema.setup_actors
  select * from test.setup_actors;
drop table test.setup_actors;

--echo #
--echo # MDEV-25325 column_comment for performance_schema tables
--echo #
select column_name, column_comment 
from information_schema.columns 
where table_schema='performance_schema' and table_name='setup_actors';