Commit c6a34288 authored by Sergey Glukhov's avatar Sergey Glukhov

Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema

backport to Betony
parent 2624eabc
...@@ -641,7 +641,7 @@ TABLE_CONSTRAINTS SYSTEM VIEW ...@@ -641,7 +641,7 @@ TABLE_CONSTRAINTS SYSTEM VIEW
TABLE_PRIVILEGES SYSTEM VIEW TABLE_PRIVILEGES SYSTEM VIEW
TRIGGERS SYSTEM VIEW TRIGGERS SYSTEM VIEW
create table t1(a int); create table t1(a int);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
use test; use test;
show tables; show tables;
Tables_in_test Tables_in_test
...@@ -1643,3 +1643,41 @@ TEST_RESULT ...@@ -1643,3 +1643,41 @@ TEST_RESULT
OK OK
SET TIMESTAMP=DEFAULT; SET TIMESTAMP=DEFAULT;
End of 5.1 tests. End of 5.1 tests.
create table information_schema.t1 (f1 INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop table information_schema.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop temporary table if exists information_schema.t1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
create temporary table information_schema.t1 (f1 INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop view information_schema.v1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
create view information_schema.v1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
create trigger mysql.trg1 after insert on information_schema.t1 for each row set @a=1;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
create table t1 select * from information_schema.t1;
ERROR 42S02: Unknown table 't1' in information_schema
CREATE TABLE t1(f1 char(100));
REPAIR TABLE t1, information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CHECKSUM TABLE t1, information_schema.tables;
Table Checksum
test.t1 0
information_schema.tables 0
ANALYZE TABLE t1, information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CHECK TABLE t1, information_schema.tables;
Table Op Msg_type Msg_text
test.t1 check status OK
information_schema.tables check note The storage engine for the table doesn't support check
OPTIMIZE TABLE t1, information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME TABLE v1 to v2, information_schema.tables to t2;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE t1, information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
LOCK TABLES t1 READ, information_schema.tables READ;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE t1;
...@@ -15,8 +15,7 @@ let $message= root: create a table with a name of an IS table directly in IS; ...@@ -15,8 +15,7 @@ let $message= root: create a table with a name of an IS table directly in IS;
let $dd_part1= CREATE TABLE; let $dd_part1= CREATE TABLE;
let $dd_part2= ( c1 INT ); let $dd_part2= ( c1 INT );
--source suite/funcs_1/datadict/basics_mixed2.inc --source suite/funcs_1/datadict/basics_mixed2.inc
# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading --error ER_DBACCESS_DENIED_ERROR
--error ER_UNKNOWN_TABLE
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
# #
# 1.2 CREATE VIEW # 1.2 CREATE VIEW
...@@ -26,8 +25,7 @@ CREATE VIEW tables AS SELECT 'garbage'; ...@@ -26,8 +25,7 @@ CREATE VIEW tables AS SELECT 'garbage';
--error ER_DBACCESS_DENIED_ERROR --error ER_DBACCESS_DENIED_ERROR
CREATE VIEW tables AS SELECT * FROM information_schema.tables; CREATE VIEW tables AS SELECT * FROM information_schema.tables;
# 1.2.2 New view # 1.2.2 New view
# ER_DBACCESS_DENIED_ERROR would be better. --error ER_DBACCESS_DENIED_ERROR
--error ER_UNKNOWN_TABLE
CREATE VIEW v1 AS SELECT 'garbage'; CREATE VIEW v1 AS SELECT 'garbage';
# 2 Attempt to create tables and views when residing in information_schema # 2 Attempt to create tables and views when residing in information_schema
...@@ -37,8 +35,7 @@ let $message= root: create a table with a name of an IS table from other db; ...@@ -37,8 +35,7 @@ let $message= root: create a table with a name of an IS table from other db;
let $dd_part1= CREATE TABLE information_schema.; let $dd_part1= CREATE TABLE information_schema.;
let $dd_part2= ( c1 INT ); let $dd_part2= ( c1 INT );
--source suite/funcs_1/datadict/basics_mixed2.inc --source suite/funcs_1/datadict/basics_mixed2.inc
# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading --error ER_DBACCESS_DENIED_ERROR
--error ER_UNKNOWN_TABLE
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
# #
# Hit on existing INFORMATION_SCHEMA table # Hit on existing INFORMATION_SCHEMA table
...@@ -48,6 +45,5 @@ CREATE VIEW information_schema.tables AS SELECT 'garbage'; ...@@ -48,6 +45,5 @@ CREATE VIEW information_schema.tables AS SELECT 'garbage';
CREATE VIEW information_schema.tables AS CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables; SELECT * FROM information_schema.tables;
# New table # New table
# ER_DBACCESS_DENIED_ERROR would be better. --error ER_DBACCESS_DENIED_ERROR
--error ER_UNKNOWN_TABLE
CREATE VIEW information_schema.v1 AS SELECT 'garbage'; CREATE VIEW information_schema.v1 AS SELECT 'garbage';
...@@ -88,13 +88,13 @@ eval ALTER TABLE $table DROP COLUMN $drop_column; ...@@ -88,13 +88,13 @@ eval ALTER TABLE $table DROP COLUMN $drop_column;
--error ER_DBACCESS_DENIED_ERROR --error ER_DBACCESS_DENIED_ERROR
eval ALTER TABLE $table ADD COLUMN (my_column INT); eval ALTER TABLE $table ADD COLUMN (my_column INT);
--error ER_UNKNOWN_TABLE --error ER_DBACCESS_DENIED_ERROR
eval RENAME TABLE $table TO new_$table; eval RENAME TABLE $table TO new_$table;
--error ER_DBACCESS_DENIED_ERROR --error ER_DBACCESS_DENIED_ERROR
eval RENAME TABLE $table TO files; eval RENAME TABLE $table TO files;
--error ER_UNKNOWN_TABLE --error ER_DBACCESS_DENIED_ERROR
eval CREATE TABLE new_$table AS SELECT * FROM $table; eval CREATE TABLE new_$table AS SELECT * FROM $table;
#---------------------------------------------------------------------- #----------------------------------------------------------------------
......
...@@ -73,13 +73,13 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -73,13 +73,13 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
CREATE TABLE triggers ( c1 INT ); CREATE TABLE triggers ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT 'garbage'; CREATE VIEW tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables; CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW v1 AS SELECT 'garbage'; CREATE VIEW v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
USE test; USE test;
CREATE TABLE information_schema. schemata ( c1 INT ); CREATE TABLE information_schema. schemata ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
...@@ -114,14 +114,14 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -114,14 +114,14 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
CREATE TABLE information_schema. triggers ( c1 INT ); CREATE TABLE information_schema. triggers ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS SELECT 'garbage'; CREATE VIEW information_schema.tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables; SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.v1 AS SELECT 'garbage'; CREATE VIEW information_schema.v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP USER 'testuser1'@'localhost'; DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost'; CREATE USER 'testuser1'@'localhost';
GRANT ALL ON *.* TO testuser1@localhost; GRANT ALL ON *.* TO testuser1@localhost;
...@@ -163,13 +163,13 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'informa ...@@ -163,13 +163,13 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'informa
CREATE TABLE triggers ( c1 INT ); CREATE TABLE triggers ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT 'garbage'; CREATE VIEW tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables; CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW v1 AS SELECT 'garbage'; CREATE VIEW v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
USE test; USE test;
CREATE TABLE information_schema. schemata ( c1 INT ); CREATE TABLE information_schema. schemata ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
...@@ -204,14 +204,14 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'informa ...@@ -204,14 +204,14 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'informa
CREATE TABLE information_schema. triggers ( c1 INT ); CREATE TABLE information_schema. triggers ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT); CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS SELECT 'garbage'; CREATE VIEW information_schema.tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables; SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.v1 AS SELECT 'garbage'; CREATE VIEW information_schema.v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
# Switch to connection default (user=root) and close connection testuser1 # Switch to connection default (user=root) and close connection testuser1
DROP USER 'testuser1'@'localhost'; DROP USER 'testuser1'@'localhost';
############################################################################### ###############################################################################
...@@ -584,9 +584,7 @@ DROP PROCEDURE IF EXISTS test.p1; ...@@ -584,9 +584,7 @@ DROP PROCEDURE IF EXISTS test.p1;
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
INSERT INTO information_schema.tables INSERT INTO information_schema.tables
SELECT * FROM information_schema.tables LIMIT 1; SELECT * FROM information_schema.tables LIMIT 1;
CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
UPDATE information_schema.columns SET table_schema = 'garbage'; UPDATE information_schema.columns SET table_schema = 'garbage';
CALL test.p1(); CALL test.p1();
...@@ -594,9 +592,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -594,9 +592,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
DROP PROCEDURE test.p1; DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
DELETE FROM information_schema.schemata; DELETE FROM information_schema.schemata;
CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP PROCEDURE test.p1;
######################################################################### #########################################################################
# Testcase 3.2.17.1+3.2.17.2: To be implemented outside of this script # Testcase 3.2.17.1+3.2.17.2: To be implemented outside of this script
######################################################################### #########################################################################
...@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
ALTER TABLE processlist ADD COLUMN (my_column INT); ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO new_processlist; RENAME TABLE processlist TO new_processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO files; RENAME TABLE processlist TO files;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE new_processlist AS SELECT * FROM processlist; CREATE TABLE new_processlist AS SELECT * FROM processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP DATABASE information_schema; DROP DATABASE information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema; RENAME DATABASE information_schema TO info_schema;
...@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in ...@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in
ALTER TABLE processlist ADD COLUMN (my_column INT); ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO new_processlist; RENAME TABLE processlist TO new_processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO files; RENAME TABLE processlist TO files;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
CREATE TABLE new_processlist AS SELECT * FROM processlist; CREATE TABLE new_processlist AS SELECT * FROM processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
DROP DATABASE information_schema; DROP DATABASE information_schema;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema; RENAME DATABASE information_schema TO info_schema;
......
...@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
ALTER TABLE processlist ADD COLUMN (my_column INT); ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO new_processlist; RENAME TABLE processlist TO new_processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO files; RENAME TABLE processlist TO files;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE new_processlist AS SELECT * FROM processlist; CREATE TABLE new_processlist AS SELECT * FROM processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP DATABASE information_schema; DROP DATABASE information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema; RENAME DATABASE information_schema TO info_schema;
...@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in ...@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in
ALTER TABLE processlist ADD COLUMN (my_column INT); ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO new_processlist; RENAME TABLE processlist TO new_processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME TABLE processlist TO files; RENAME TABLE processlist TO files;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
CREATE TABLE new_processlist AS SELECT * FROM processlist; CREATE TABLE new_processlist AS SELECT * FROM processlist;
ERROR 42S02: Unknown table 'new_processlist' in information_schema ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
DROP DATABASE information_schema; DROP DATABASE information_schema;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema; RENAME DATABASE information_schema TO info_schema;
......
...@@ -468,25 +468,20 @@ DROP DATABASE db_datadict; ...@@ -468,25 +468,20 @@ DROP DATABASE db_datadict;
--disable_warnings --disable_warnings
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
--enable_warnings --enable_warnings
--error ER_DBACCESS_DENIED_ERROR
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
INSERT INTO information_schema.tables INSERT INTO information_schema.tables
SELECT * FROM information_schema.tables LIMIT 1; SELECT * FROM information_schema.tables LIMIT 1;
--error ER_DBACCESS_DENIED_ERROR
CALL test.p1();
DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
UPDATE information_schema.columns SET table_schema = 'garbage'; UPDATE information_schema.columns SET table_schema = 'garbage';
--error ER_DBACCESS_DENIED_ERROR --error ER_DBACCESS_DENIED_ERROR
CALL test.p1(); CALL test.p1();
DROP PROCEDURE test.p1; DROP PROCEDURE test.p1;
--error ER_DBACCESS_DENIED_ERROR
CREATE PROCEDURE test.p1() CREATE PROCEDURE test.p1()
DELETE FROM information_schema.schemata; DELETE FROM information_schema.schemata;
--error ER_DBACCESS_DENIED_ERROR
CALL test.p1();
DROP PROCEDURE test.p1;
--echo ######################################################################### --echo #########################################################################
......
...@@ -366,7 +366,7 @@ show tables from information_schema like "T%"; ...@@ -366,7 +366,7 @@ show tables from information_schema like "T%";
create database information_schema; create database information_schema;
use information_schema; use information_schema;
show full tables like "T%"; show full tables like "T%";
--error ER_UNKNOWN_TABLE --error ER_DBACCESS_DENIED_ERROR
create table t1(a int); create table t1(a int);
use test; use test;
show tables; show tables;
...@@ -1394,3 +1394,40 @@ SET TIMESTAMP=DEFAULT; ...@@ -1394,3 +1394,40 @@ SET TIMESTAMP=DEFAULT;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
#
# Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
#
--error ER_DBACCESS_DENIED_ERROR
create table information_schema.t1 (f1 INT);
--error ER_DBACCESS_DENIED_ERROR
drop table information_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
drop temporary table if exists information_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
create temporary table information_schema.t1 (f1 INT);
--error ER_DBACCESS_DENIED_ERROR
drop view information_schema.v1;
--error ER_DBACCESS_DENIED_ERROR
create view information_schema.v1;
--error ER_DBACCESS_DENIED_ERROR
create trigger mysql.trg1 after insert on information_schema.t1 for each row set @a=1;
--error 1109
create table t1 select * from information_schema.t1;
CREATE TABLE t1(f1 char(100));
--error ER_DBACCESS_DENIED_ERROR
REPAIR TABLE t1, information_schema.tables;
CHECKSUM TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
ANALYZE TABLE t1, information_schema.tables;
CHECK TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
OPTIMIZE TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
RENAME TABLE v1 to v2, information_schema.tables to t2;
--error ER_DBACCESS_DENIED_ERROR
DROP TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
LOCK TABLES t1 READ, information_schema.tables READ;
DROP TABLE t1;
...@@ -6338,7 +6338,19 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -6338,7 +6338,19 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db, if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db,
INFORMATION_SCHEMA_NAME.str)) INFORMATION_SCHEMA_NAME.str))
{ {
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name); ST_SCHEMA_TABLE *schema_table;
if (ptr->updating &&
/* Special cases which are processed by commands itself */
lex->sql_command != SQLCOM_CHECK &&
lex->sql_command != SQLCOM_CHECKSUM)
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->security_ctx->priv_user,
thd->security_ctx->priv_host,
INFORMATION_SCHEMA_NAME.str);
DBUG_RETURN(0);
}
schema_table= find_schema_table(thd, ptr->table_name);
if (!schema_table || if (!schema_table ||
(schema_table->hidden && (schema_table->hidden &&
((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 || ((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment