mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into example.com:/work/bug22369-v2/my51 mysql-test/r/alter_table.result: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/t/grant.test: Auto merged sql/mysql_priv.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged mysql-test/t/alter_table.test: manual merge
This commit is contained in:
@ -822,6 +822,82 @@ create user mysqltest1_thisisreallytoolong;
|
||||
# statements.
|
||||
#
|
||||
|
||||
#
|
||||
# Bug #22369: Alter table rename combined with other alterations causes lost tables
|
||||
#
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TABLE mysqltest1.t1 (
|
||||
int_field INTEGER UNSIGNED NOT NULL,
|
||||
char_field CHAR(10),
|
||||
INDEX(`int_field`)
|
||||
);
|
||||
CREATE TABLE mysqltest1.t2 (int_field INT);
|
||||
|
||||
--echo "Now check that we require equivalent grants for "
|
||||
--echo "RENAME TABLE and ALTER TABLE"
|
||||
CREATE USER mysqltest_1@localhost;
|
||||
GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
|
||||
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
SELECT USER();
|
||||
SHOW GRANTS;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
RENAME TABLE t1 TO t2;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost;
|
||||
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
RENAME TABLE t1 TO t2;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost;
|
||||
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
SHOW GRANTS;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
RENAME TABLE t1 TO t2;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost;
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
SHOW GRANTS;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
GRANT INSERT, SELECT, CREATE, ALTER, DROP ON mysqltest1.t2 TO mysqltest_1@localhost;
|
||||
DROP TABLE mysqltest1.t2;
|
||||
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
SHOW GRANTS;
|
||||
RENAME TABLE t1 TO t2;
|
||||
RENAME TABLE t2 TO t1;
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
REVOKE DROP, INSERT ON mysqltest1.t1 FROM mysqltest_1@localhost;
|
||||
REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
|
||||
|
||||
--connect (conn42,localhost,mysqltest_1,,mysqltest1);
|
||||
SHOW GRANTS;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
RENAME TABLE t1 TO t2;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
--disconnect conn42
|
||||
--connection default
|
||||
|
||||
DROP USER mysqltest_1@localhost;
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
# Working with database-level privileges.
|
||||
|
||||
--error ER_WRONG_STRING_LENGTH
|
||||
|
Reference in New Issue
Block a user