Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c6a34288
Commit
c6a34288
authored
Oct 23, 2009
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
backport to Betony
parent
2624eabc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
114 additions
and
40 deletions
+114
-40
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+39
-1
mysql-test/suite/funcs_1/datadict/basics_mixed1.inc
mysql-test/suite/funcs_1/datadict/basics_mixed1.inc
+4
-8
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
+2
-2
mysql-test/suite/funcs_1/r/is_basics_mixed.result
mysql-test/suite/funcs_1/r/is_basics_mixed.result
+8
-12
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
+4
-4
mysql-test/suite/funcs_1/r/processlist_priv_ps.result
mysql-test/suite/funcs_1/r/processlist_priv_ps.result
+4
-4
mysql-test/suite/funcs_1/t/is_basics_mixed.test
mysql-test/suite/funcs_1/t/is_basics_mixed.test
+2
-7
mysql-test/t/information_schema.test
mysql-test/t/information_schema.test
+38
-1
sql/sql_parse.cc
sql/sql_parse.cc
+13
-1
No files found.
mysql-test/r/information_schema.result
View file @
c6a34288
...
...
@@ -641,7 +641,7 @@ TABLE_CONSTRAINTS SYSTEM VIEW
TABLE_PRIVILEGES SYSTEM VIEW
TRIGGERS SYSTEM VIEW
create table t1(a int);
ERROR 42
S02: Unknown table 't1' in information_schema
ERROR 42
000: Access denied for user 'root'@'localhost' to database 'information_schema'
use test;
show tables;
Tables_in_test
...
...
@@ -1643,3 +1643,41 @@ TEST_RESULT
OK
SET TIMESTAMP=DEFAULT;
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;
mysql-test/suite/funcs_1/datadict/basics_mixed1.inc
View file @
c6a34288
...
...
@@ -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_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 a name of an IS table from other db;
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 SELECT 'garbage';
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'
;
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
View file @
c6a34288
...
...
@@ -88,13 +88,13 @@ eval ALTER TABLE $table DROP COLUMN $drop_column;
--
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
;
#----------------------------------------------------------------------
...
...
mysql-test/suite/funcs_1/r/is_basics_mixed.result
View file @
c6a34288
...
...
@@ -73,13 +73,13 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
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 42
S02: Unknown table 't1' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'v1' in information_schema
ERROR 42
000: 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 'root'@'localhost' to database 'information_
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 42
S02: Unknown table 't1' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'v1' in information_schema
ERROR 42
000: 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 'testuser1'@'localhost' to database 'informa
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 42
S02: Unknown table 't1' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'v1' in information_schema
ERROR 42
000: 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 'testuser1'@'localhost' to database 'informa
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 42
S02: Unknown table 't1' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'v1' in information_schema
ERROR 42
000: 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 'root'@'localhost' to database 'information_
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
#########################################################################
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
View file @
c6a34288
...
...
@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 'ddicttestuser1'@'localhost' to database 'in
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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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;
...
...
mysql-test/suite/funcs_1/r/processlist_priv_ps.result
View file @
c6a34288
...
...
@@ -74,11 +74,11 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 'ddicttestuser1'@'localhost' to database 'in
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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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 42
S02: Unknown table 'new_processlist' in information_schema
ERROR 42
000: 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;
...
...
mysql-test/suite/funcs_1/t/is_basics_mixed.test
View file @
c6a34288
...
...
@@ -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
#########################################################################
...
...
mysql-test/t/information_schema.test
View file @
c6a34288
...
...
@@ -366,7 +366,7 @@ show tables from information_schema like "T%";
create
database
information_schema
;
use
information_schema
;
show
full
tables
like
"T%"
;
--
error
ER_
UNKNOWN_TABLE
--
error
ER_
DBACCESS_DENIED_ERROR
create
table
t1
(
a
int
);
use
test
;
show
tables
;
...
...
@@ -1394,3 +1394,40 @@ SET TIMESTAMP=DEFAULT;
# Wait till all disconnects are completed
--
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
;
sql/sql_parse.cc
View file @
c6a34288
...
...
@@ -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
,
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
||
(
schema_table
->
hidden
&&
((
sql_command_flags
[
lex
->
sql_command
]
&
CF_STATUS_COMMAND
)
==
0
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment