1# Tests for PERFORMANCE_SCHEMA
2
3--source include/not_embedded.inc
4--source include/have_perfschema.inc
5
6#==============================================================================
7# This test verifies that the peformance schema storage engine does not support
8# HANDLER operations.
9#
10# Get the list of tables from information_schema.tables, store the table names
11# in a temporary table. For each table in the list, attempt a HANDLER ... OPEN,
12# which should return error 1031, "Table storage engine for '<table name>'
13# doesn't have this option."
14#
15--echo
16--echo # Create a temporary table of performance schema table names
17--echo
18
19CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS
20  SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
21  WHERE TABLE_SCHEMA='performance_schema'
22  ORDER BY TABLE_NAME;
23
24SELECT COUNT(*) FROM table_list INTO @table_count;
25
26let $count=`SELECT @table_count`;
27
28--echo
29--echo # For each table in the performance schema, attempt HANDLER...OPEN,
30--echo # which should fail with an error 1031, ER_ILLEGAL_HA.
31--echo
32
33while ($count > 0)
34{
35   eval SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=$count;
36   let $table_name = `SELECT @table_name`;
37   --error ER_ILLEGAL_HA
38   eval HANDLER performance_schema.$table_name OPEN;
39   dec $count;
40}
41
42DROP TEMPORARY TABLE table_list;
43
44