#At file:///home/gluh/MySQL/mysql-6.0-bugteam/ based on revid:sergey.glukhov@stripped
2818 Sergey Glukhov 2008-12-17
Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
issue ER_DBACCESS_DENIED_ERROR error for commands
which try to use metadata changing commands on I_S tables
modified:
mysql-test/r/information_schema.result
mysql-test/suite/funcs_1/datadict/basics_mixed1.inc
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
mysql-test/suite/funcs_1/r/is_basics_mixed.result
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
mysql-test/suite/funcs_1/r/processlist_priv_ps.result
mysql-test/suite/funcs_1/r/processlist_val_ps.result
mysql-test/suite/funcs_1/t/is_basics_mixed.test
mysql-test/t/information_schema.test
sql/sql_parse.cc
per-file messages:
mysql-test/r/information_schema.result
test result
mysql-test/suite/funcs_1/datadict/basics_mixed1.inc
test fix
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
test fix
mysql-test/suite/funcs_1/r/is_basics_mixed.result
result fix
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
result fix
mysql-test/suite/funcs_1/r/processlist_priv_ps.result
result fix
mysql-test/suite/funcs_1/r/processlist_val_ps.result
result fix
mysql-test/suite/funcs_1/t/is_basics_mixed.test
test fix
mysql-test/t/information_schema.test
test case
sql/sql_parse.cc
issue ER_DBACCESS_DENIED_ERROR error for commands
which try to use metadata changing commands on I_S tables
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result 2008-12-17 16:16:15 +0000
+++ b/mysql-test/r/information_schema.result 2008-12-17 16:51:28 +0000
@@ -646,7 +646,7 @@ TABLE_CONSTRAINTS SYSTEM VIEW
TABLE_PRIVILEGES SYSTEM VIEW
TRIGGERS SYSTEM VIEW
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;
show tables;
Tables_in_test
@@ -1750,3 +1750,19 @@ EXPLAIN SELECT * FROM INFORMATION_SCHEMA
WHERE EVENT_OBJECT_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TRIGGERS ALL NULL EVENT_OBJECT_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database
+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
=== modified file 'mysql-test/suite/funcs_1/datadict/basics_mixed1.inc'
--- a/mysql-test/suite/funcs_1/datadict/basics_mixed1.inc 2008-03-07 16:33:07 +0000
+++ b/mysql-test/suite/funcs_1/datadict/basics_mixed1.inc 2008-12-17 16:51:28 +0000
@@ -15,8 +15,7 @@ let $message= root: create a table with
let $dd_part1= CREATE TABLE;
let $dd_part2= ( c1 INT );
--source suite/funcs_1/datadict/basics_mixed2.inc
-# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading
---error ER_UNKNOWN_TABLE
+--error ER_DBACCESS_DENIED_ERROR
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
#
# 1.2 CREATE VIEW
@@ -26,8 +25,7 @@ CREATE VIEW tables AS SELECT 'garbage';
--error ER_DBACCESS_DENIED_ERROR
CREATE VIEW tables AS SELECT * FROM information_schema.tables;
# 1.2.2 New view
-# ER_DBACCESS_DENIED_ERROR would be better.
---error ER_UNKNOWN_TABLE
+--error ER_DBACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT 'garbage';
# 2 Attempt to create tables and views when residing in information_schema
@@ -37,8 +35,7 @@ let $message= root: create a table with
let $dd_part1= CREATE TABLE information_schema.;
let $dd_part2= ( c1 INT );
--source suite/funcs_1/datadict/basics_mixed2.inc
-# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading
---error ER_UNKNOWN_TABLE
+--error ER_DBACCESS_DENIED_ERROR
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
#
# Hit on existing INFORMATION_SCHEMA table
@@ -48,6 +45,5 @@ CREATE VIEW information_schema.tables AS
CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables;
# New table
-# ER_DBACCESS_DENIED_ERROR would be better.
---error ER_UNKNOWN_TABLE
+--error ER_DBACCESS_DENIED_ERROR
CREATE VIEW information_schema.v1 AS SELECT 'garbage';
=== modified file 'mysql-test/suite/funcs_1/datadict/datadict_priv.inc'
--- a/mysql-test/suite/funcs_1/datadict/datadict_priv.inc 2007-10-29 08:31:13 +0000
+++ b/mysql-test/suite/funcs_1/datadict/datadict_priv.inc 2008-12-17 16:51:28 +0000
@@ -88,13 +88,13 @@ eval ALTER TABLE $table DROP COLUMN $dro
--error ER_DBACCESS_DENIED_ERROR
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;
--error ER_DBACCESS_DENIED_ERROR
eval RENAME TABLE $table TO files;
---error ER_UNKNOWN_TABLE
+--error ER_DBACCESS_DENIED_ERROR
eval CREATE TABLE new_$table AS SELECT * FROM $table;
#----------------------------------------------------------------------
=== modified file 'mysql-test/suite/funcs_1/r/is_basics_mixed.result'
--- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result 2008-03-07 19:18:14 +0000
+++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result 2008-12-17 16:51:28 +0000
@@ -73,13 +73,13 @@ ERROR 42000: Access denied for user 'roo
CREATE TABLE triggers ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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;
CREATE TABLE information_schema. schemata ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
@@ -114,14 +114,14 @@ ERROR 42000: Access denied for user 'roo
CREATE TABLE information_schema. triggers ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON *.* TO testuser1@localhost;
@@ -163,13 +163,13 @@ ERROR 42000: Access denied for user 'tes
CREATE TABLE triggers ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
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';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
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;
CREATE TABLE information_schema. schemata ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
@@ -204,14 +204,14 @@ ERROR 42000: Access denied for user 'tes
CREATE TABLE information_schema. triggers ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
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';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
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
DROP USER 'testuser1'@'localhost';
###############################################################################
@@ -584,9 +584,7 @@ DROP PROCEDURE IF EXISTS test.p1;
CREATE PROCEDURE test.p1()
INSERT INTO information_schema.tables
SELECT * FROM information_schema.tables LIMIT 1;
-CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
-DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1()
UPDATE information_schema.columns SET table_schema = 'garbage';
CALL test.p1();
@@ -594,9 +592,7 @@ ERROR 42000: Access denied for user 'roo
DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1()
DELETE FROM information_schema.schemata;
-CALL test.p1();
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
#########################################################################
=== modified file 'mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result'
--- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2008-10-20 09:16:47 +0000
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2008-12-17 16:51:28 +0000
@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'roo
ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema;
@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddi
ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema;
=== modified file 'mysql-test/suite/funcs_1/r/processlist_priv_ps.result'
--- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result 2008-10-20 09:16:47 +0000
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result 2008-12-17 16:51:28 +0000
@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'roo
ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema;
@@ -141,11 +141,11 @@ ERROR 42000: Access denied for user 'ddi
ALTER TABLE processlist ADD COLUMN (my_column INT);
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
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;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
RENAME DATABASE information_schema TO info_schema;
=== modified file 'mysql-test/suite/funcs_1/r/processlist_val_ps.result'
--- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result 2008-10-20 09:16:47 +0000
+++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result 2008-12-17 16:51:28 +0000
@@ -20,7 +20,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROC
`TIME` bigint(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
-) ENGINE=MARIA DEFAULT CHARSET=utf8 PAGE_CHECKSUM=0
+) DEFAULT CHARSET=utf8
# Ensure that the information about the own connection is correct.
#--------------------------------------------------------------------------
=== modified file 'mysql-test/suite/funcs_1/t/is_basics_mixed.test'
--- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test 2008-06-16 18:39:58 +0000
+++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test 2008-12-17 16:51:28 +0000
@@ -468,25 +468,20 @@ DROP DATABASE db_datadict;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
--enable_warnings
+--error ER_DBACCESS_DENIED_ERROR
CREATE PROCEDURE test.p1()
INSERT INTO information_schema.tables
SELECT * FROM information_schema.tables LIMIT 1;
---error ER_DBACCESS_DENIED_ERROR
-CALL test.p1();
-DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1()
UPDATE information_schema.columns SET table_schema = 'garbage';
--error ER_DBACCESS_DENIED_ERROR
CALL test.p1();
DROP PROCEDURE test.p1;
+--error ER_DBACCESS_DENIED_ERROR
CREATE PROCEDURE test.p1()
DELETE FROM information_schema.schemata;
---error ER_DBACCESS_DENIED_ERROR
-CALL test.p1();
-
-DROP PROCEDURE test.p1;
--echo #########################################################################
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2008-12-17 16:16:15 +0000
+++ b/mysql-test/t/information_schema.test 2008-12-17 16:51:28 +0000
@@ -360,7 +360,7 @@ show tables from information_schema like
create database information_schema;
use information_schema;
show full tables like "T%";
---error 1109
+--error 1044
create table t1(a int);
use test;
show tables;
@@ -1463,3 +1463,22 @@ EXPLAIN SELECT * FROM INFORMATION_SCHEMA
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE EVENT_OBJECT_SCHEMA='test';
+#
+# Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
+#
+--error 1044
+create table information_schema.t1 (f1 INT);
+--error 1044
+drop table information_schema.t1;
+--error 1044
+drop temporary table if exists information_schema.t1;
+--error 1044
+create temporary table information_schema.t1 (f1 INT);
+--error 1044
+drop view information_schema.v1;
+--error 1044
+create view information_schema.v1;
+--error 1044
+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;
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2008-12-17 13:48:30 +0000
+++ b/sql/sql_parse.cc 2008-12-17 16:51:28 +0000
@@ -6034,7 +6034,16 @@ TABLE_LIST *st_select_lex::add_table_to_
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db,
INFORMATION_SCHEMA_NAME.str))
{
- ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name);
+ ST_SCHEMA_TABLE *schema_table;
+ if (ptr->updating)
+ {
+ 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 ||
(schema_table->hidden &&
((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
| Thread |
|---|
| • bzr commit into mysql-6.0-bugteam branch (Sergey.Glukhov:2818)Bug#24062 | Sergey Glukhov | 17 Dec |