2012-08-14 17:23:34 +03:00
|
|
|
# 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
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2017-02-08 15:28:00 -05:00
|
|
|
set sql_mode= '';
|
2012-08-14 17:23:34 +03:00
|
|
|
--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';
|
2017-02-08 15:28:00 -05:00
|
|
|
set sql_mode= DEFAULT;
|
2012-08-14 17:23:34 +03:00
|
|
|
|
|
|
|
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
|
2017-02-08 15:28:00 -05:00
|
|
|
set statement sql_mode = '' for
|
2012-08-14 17:23:34 +03:00
|
|
|
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;
|
|
|
|
|