mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#53696 Performance schema engine violates the PSEA API by calling my_error()
This is a code cleanup. The implementation of a storage engine (subclasses of handler) is not supposed to call my_error() directly inside the engine implementation, but only return error codes, and report errors later at the demand of the sql layer only (if needed), using handler::print_error(). This fix removes misplaced calls to my_error(), and provide an implementation of print_error() instead. Given that the sql layer implementation of create table, ha_create_table(), does not use print_error() but returns ER_CANT_CREATE_TABLE directly, the return code for create table statements using the performance schema has changed to ER_CANT_CREATE_TABLE. Adjusted the test suite accordingly.
This commit is contained in:
@ -100,16 +100,16 @@ create trigger performance_schema.bi_file_instances
|
||||
before insert on performance_schema.file_instances
|
||||
for each row begin end;
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1 like performance_schema.setup_instruments;
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1 like performance_schema.file_instances;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
|
@ -6,9 +6,9 @@ AND EVENT_NAME IN
|
||||
WHERE NAME LIKE "wait/synch/%")
|
||||
LIMIT 1;
|
||||
create table test.t1(a int) engine=performance_schema;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table performance_schema.t1(a int);
|
||||
ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1'
|
||||
drop table if exists test.ghost;
|
||||
|
@ -152,13 +152,13 @@ before insert on performance_schema.file_instances
|
||||
for each row begin end;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
|
||||
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.setup_instruments;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.file_instances;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
insert into performance_schema.setup_instruments
|
||||
set name="foo";
|
||||
ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments'
|
||||
@ -250,13 +250,13 @@ before insert on performance_schema.file_instances
|
||||
for each row begin end;
|
||||
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
|
||||
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.setup_instruments;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.file_instances;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
insert into performance_schema.setup_instruments
|
||||
set name="foo";
|
||||
ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments'
|
||||
@ -348,13 +348,13 @@ before insert on performance_schema.file_instances
|
||||
for each row begin end;
|
||||
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
|
||||
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.setup_instruments;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.file_instances;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
insert into performance_schema.setup_instruments
|
||||
set name="foo";
|
||||
ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments'
|
||||
@ -446,13 +446,13 @@ before insert on performance_schema.file_instances
|
||||
for each row begin end;
|
||||
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
|
||||
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.setup_instruments;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
create table test.t1 like performance_schema.file_instances;
|
||||
ERROR HY000: Invalid performance_schema usage.
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 131)
|
||||
insert into performance_schema.setup_instruments
|
||||
set name="foo";
|
||||
ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments'
|
||||
|
@ -38,14 +38,14 @@ LIMIT 1;
|
||||
# Bug#45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA
|
||||
#
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1(a int) engine=performance_schema;
|
||||
|
||||
#
|
||||
# Bug#44897 Performance Schema: can create a ghost table in another database
|
||||
#
|
||||
|
||||
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table test.t1 like performance_schema.events_waits_current;
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user