summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/perfschema/t/dml_setup_objects.test
blob: 3055cd8b007ac5d8ed4972492443d8f5b5c5c679 (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
# Tests for PERFORMANCE_SCHEMA

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

--disable_warnings
drop table if exists test.setup_objects;
--enable_warnings
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
# Save the setup
create table test.setup_objects as
  select * from performance_schema.setup_objects;
truncate table performance_schema.setup_objects;

# Test

select * from performance_schema.setup_objects;

select * from performance_schema.setup_objects
  order by object_type, object_schema, object_name;

select * from performance_schema.setup_objects
  where object_type = 'TABLE'
  order by object_type, object_schema, object_name;

select * from performance_schema.setup_objects
  order by object_type, object_schema, object_name;

set sql_mode= '';
--error ER_NO_REFERENCED_ROW_2
insert into performance_schema.setup_objects
  set object_type='ILLEGAL', object_schema='FOO', object_name='BAR',
  enabled='YES', timed='YES';
set sql_mode= DEFAULT;

insert into performance_schema.setup_objects
  set object_type='TABLE', object_schema='FOO', object_name='BAR',
  enabled='YES', timed='YES';

--error ER_DUP_KEY
insert into performance_schema.setup_objects
  set object_type='TABLE', object_schema='FOO', object_name='BAR',
  enabled='YES', timed='NO';

delete from performance_schema.setup_objects
  where object_type='TABLE' and object_schema='FOO';

select * from performance_schema.setup_objects
  order by object_type, object_schema, object_name;

insert into performance_schema.setup_objects
  set object_type='TABLE', object_schema='FOO', object_name='BAR',
  enabled='NO', timed='YES';

select * from performance_schema.setup_objects
  order by object_type, object_schema, object_name;

--error ER_WRONG_PERFSCHEMA_USAGE
set statement sql_mode = '' for
update performance_schema.setup_objects
  set object_type='ILLEGAL';

--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.setup_objects
  set object_schema='ILLEGAL';

--error ER_WRONG_PERFSCHEMA_USAGE
update performance_schema.setup_objects
  set object_name='ILLEGAL';

update performance_schema.setup_objects
  set enabled='NO', timed='NO';

select * from performance_schema.setup_objects
  order by object_type, object_schema, object_name;

update performance_schema.setup_objects
  set enabled='YES', timed='YES';

delete from performance_schema.setup_objects
  where object_type = 'TABLE';

delete from performance_schema.setup_objects;

LOCK TABLES performance_schema.setup_objects READ;
UNLOCK TABLES;

LOCK TABLES performance_schema.setup_objects WRITE;
UNLOCK TABLES;

# Restore the setup
truncate table performance_schema.setup_objects;
insert into performance_schema.setup_objects
  select * from test.setup_objects;
drop table test.setup_objects;
SET sql_mode = default;
--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_objects';