post-merge

parent a04fc26c
...@@ -11,7 +11,7 @@ GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' ...@@ -11,7 +11,7 @@ GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant delete on mysqltest.* to mysqltest_1@localhost; grant delete on mysqltest.* to mysqltest_1@localhost;
select * from mysql.user where user="mysqltest_1"; select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
...@@ -41,15 +41,15 @@ delete from mysql.user where user='mysqltest_1'; ...@@ -41,15 +41,15 @@ delete from mysql.user where user='mysqltest_1';
flush privileges; flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10; grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
select * from mysql.user where user="mysqltest_1"; select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 0 0 localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30; grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
select * from mysql.user where user="mysqltest_1"; select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 20 30 localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
...@@ -388,9 +388,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column ...@@ -388,9 +388,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column
update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1; update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
...@@ -411,14 +411,14 @@ flush privileges; ...@@ -411,14 +411,14 @@ flush privileges;
use mysqltest_1; use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
use mysqltest_2; use mysqltest_2;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't2' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
ERROR 42000: update command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r a q b r
10 2 1 2 10 2 1 2
......
...@@ -47,9 +47,9 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' ...@@ -47,9 +47,9 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
insert into t1 values (1, 'I can''t change it!'); insert into t1 values (1, 'I can''t change it!');
update t1 set data='I can change it!' where id = 1; update t1 set data='I can change it!' where id = 1;
ERROR 42000: update command denied to user 'mysqltest_1'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!'; insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
ERROR 42000: update command denied to user 'mysqltest_1'@'localhost' for table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
select * from t1; select * from t1;
id data id data
1 I can't change it! 1 I can't change it!
...@@ -57,6 +57,20 @@ drop table t1; ...@@ -57,6 +57,20 @@ drop table t1;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
flush privileges; flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
set sql_mode='maxdb'; set sql_mode='maxdb';
drop table if exists t1, t2; drop table if exists t1, t2;
create table t1(c1 int); create table t1(c1 int);
...@@ -199,7 +213,7 @@ drop user '%@a'@'a'; ...@@ -199,7 +213,7 @@ drop user '%@a'@'a';
create user mysqltest_2@localhost; create user mysqltest_2@localhost;
grant usage on *.* to mysqltest_2@localhost with grant option; grant usage on *.* to mysqltest_2@localhost with grant option;
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 'user' ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 'user'
create user mysqltest_A@'%'; create user mysqltest_A@'%';
rename user mysqltest_A@'%' to mysqltest_B@'%'; rename user mysqltest_A@'%' to mysqltest_B@'%';
drop user mysqltest_B@'%'; drop user mysqltest_B@'%';
...@@ -219,17 +233,3 @@ drop user mysqltest_B@'%'; ...@@ -219,17 +233,3 @@ drop user mysqltest_B@'%';
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql' ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql'
drop user mysqltest_B@'%'; drop user mysqltest_B@'%';
drop user mysqltest_3@localhost; drop user mysqltest_3@localhost;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
DROP TABLE IF EXISTS t1, `"t"1`; DROP TABLE IF EXISTS t1, `"t"1`;
drop database if exists mysqldump_test_db;
CREATE TABLE t1(a int); CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?> <?xml version="1.0"?>
...@@ -387,7 +388,6 @@ USE `test`; ...@@ -387,7 +388,6 @@ USE `test`;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
drop database mysqldump_test_db;
create database mysqldump_test_db character set latin2 collate latin2_bin; create database mysqldump_test_db character set latin2 collate latin2_bin;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
...@@ -549,4 +549,3 @@ UNLOCK TABLES; ...@@ -549,4 +549,3 @@ UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
drop database mysqldump_test_db;
...@@ -382,19 +382,19 @@ show create database mysqltest; ...@@ -382,19 +382,19 @@ show create database mysqltest;
Database Create Database Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1; drop table t1;
ERROR 42000: drop command denied to user 'mysqltest_1'@'localhost' for table 't1' ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop database mysqltest; drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
select * from mysqltest.t1; select * from mysqltest.t1;
ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't1'
show create database mysqltest; show create database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
drop table mysqltest.t1; drop table mysqltest.t1;
ERROR 42000: drop command denied to user 'mysqltest_2'@'localhost' for table 't1' ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table 't1'
drop database mysqltest; drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
select * from mysqltest.t1; select * from mysqltest.t1;
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
show create database mysqltest; show create database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest' ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
drop table mysqltest.t1; drop table mysqltest.t1;
......
...@@ -32,7 +32,7 @@ select db1_secret.db(); ...@@ -32,7 +32,7 @@ select db1_secret.db();
db1_secret.db() db1_secret.db()
db1_secret db1_secret
select * from db1_secret.t1; select * from db1_secret.t1;
ERROR 42000: select command denied to user 'user1'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;
...@@ -42,7 +42,7 @@ select db1_secret.db(); ...@@ -42,7 +42,7 @@ select db1_secret.db();
db1_secret.db() db1_secret.db()
db1_secret db1_secret
select * from db1_secret.t1; select * from db1_secret.t1;
ERROR 42000: select command denied to user ''@'localhost' for table 't1' ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;
...@@ -92,7 +92,7 @@ flush privileges; ...@@ -92,7 +92,7 @@ flush privileges;
use db2; use db2;
create procedure p () insert into t2 values (1); create procedure p () insert into t2 values (1);
call p(); call p();
ERROR 42000: insert command denied to user 'user1'@'localhost' for table 't2' ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't2'
use db2; use db2;
call p(); call p();
ERROR 42000: execute command denied to user 'user2'@'localhost' for routine 'db2.p' ERROR 42000: execute command denied to user 'user2'@'localhost' for routine 'db2.p'
......
...@@ -273,9 +273,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC') ...@@ -273,9 +273,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
flush privileges; flush privileges;
grant all privileges on test.t1 to mysqltest_1@localhost; grant all privileges on test.t1 to mysqltest_1@localhost;
......
...@@ -42,7 +42,7 @@ connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK); ...@@ -42,7 +42,7 @@ connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2) ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2)
select * from t1; select * from t1;
i i
connect(localhost,mysqltest_1,,test,9306,/home/dlenev/src/mysql-5.0-1339/mysql-test/var/tmp/master.sock); connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2) ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2)
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
flush privileges; flush privileges;
......
...@@ -237,11 +237,11 @@ grant select on mysqltest.t1 to mysqltest_1@localhost; ...@@ -237,11 +237,11 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
alter view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1;
ERROR 42000: delete command denied to user 'mysqltest_1'@'localhost' for table 'v1' ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create or replace view v1 as select * from mysqltest.t1; create or replace view v1 as select * from mysqltest.t1;
ERROR 42000: delete command denied to user 'mysqltest_1'@'localhost' for table 'v1' ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view mysqltest.v2 as select * from mysqltest.t1; create view mysqltest.v2 as select * from mysqltest.t1;
ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
create view v2 as select * from mysqltest.t2; create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2' ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
...@@ -300,39 +300,39 @@ d bigint(20) YES NULL ...@@ -300,39 +300,39 @@ d bigint(20) YES NULL
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v1; show create view mysqltest.v1;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v1' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v2; show create view mysqltest.v2;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v3; show create view mysqltest.v3;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v3' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3'
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v4; show create view mysqltest.v4;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v4' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
grant select on mysqltest.t1 to mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost;
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found 1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
show create view mysqltest.v1; show create view mysqltest.v1;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v1' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found 1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create view mysqltest.v2; show create view mysqltest.v2;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v3; show create view mysqltest.v3;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v3' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3'
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v4; show create view mysqltest.v4;
ERROR 42000: show create view command denied to user 'mysqltest_1'@'localhost' for table 'v4' ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
grant show view on mysqltest.* to mysqltest_1@localhost; grant show view on mysqltest.* to mysqltest_1@localhost;
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
...@@ -659,9 +659,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column ...@@ -659,9 +659,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column
update v2 set c=a+c; update v2 set c=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2'
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
ERROR 42000: update command denied to user 'mysqltest_1'@'localhost' for table 'v3' ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
update v3 set a=a+c; update v3 set a=a+c;
ERROR 42000: update command denied to user 'mysqltest_1'@'localhost' for table 'v3' ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
use test; use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
...@@ -756,9 +756,9 @@ select * from t1; ...@@ -756,9 +756,9 @@ select * from t1;
a b a b
5 10 5 10
delete v2 from t2,v2 where t2.x=v2.c; delete v2 from t2,v2 where t2.x=v2.c;
ERROR 42000: delete command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
delete from v2 where c < 4; delete from v2 where c < 4;
ERROR 42000: delete command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test; use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
...@@ -866,9 +866,9 @@ a b ...@@ -866,9 +866,9 @@ a b
5 6 5 6
3 4 3 4
insert into v2 values (5,6); insert into v2 values (5,6);
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
insert into v2 select x,y from t2; insert into v2 select x,y from t2;
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 'v2' ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test; use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
...@@ -925,7 +925,7 @@ grant create view,update on test.* to mysqltest_1@localhost; ...@@ -925,7 +925,7 @@ grant create view,update on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2; create view v2 as select b from mysqltest.t2;
create view mysqltest.v1 as select * from mysqltest.t1; create view mysqltest.v1 as select * from mysqltest.t1;
ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for table 'v1' ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view v3 as select a from mysqltest.t2; create view v3 as select a from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2' ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2'
create table mysqltest.v3 (b int); create table mysqltest.v3 (b int);
...@@ -943,7 +943,7 @@ create table mysqltest.v3 (b int); ...@@ -943,7 +943,7 @@ create table mysqltest.v3 (b int);
grant select(b) on mysqltest.v3 to mysqltest_1@localhost; grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
drop table mysqltest.v3; drop table mysqltest.v3;
create view mysqltest.v3 as select b from mysqltest.t2; create view mysqltest.v3 as select b from mysqltest.t2;
ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for table 'v3' ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3'
create view v4 as select b+1 from mysqltest.t2; create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
grant create view,update,select on test.* to mysqltest_1@localhost; grant create view,update,select on test.* to mysqltest_1@localhost;
......
...@@ -76,6 +76,28 @@ drop table t1; ...@@ -76,6 +76,28 @@ drop table t1;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
flush privileges; flush privileges;
#
#
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
# #
# Create and drop user # Create and drop user
...@@ -224,26 +246,3 @@ connection default; ...@@ -224,26 +246,3 @@ connection default;
drop user mysqltest_B@'%'; drop user mysqltest_B@'%';
drop user mysqltest_3@localhost; drop user mysqltest_3@localhost;
# #
#
#
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`; DROP TABLE IF EXISTS t1, `"t"1`;
drop database if exists mysqldump_test_db;
--enable_warnings --enable_warnings
# XML output # XML output
......
...@@ -72,6 +72,7 @@ select * from t1; ...@@ -72,6 +72,7 @@ select * from t1;
# counters are not thrown away if there are no connections for this user. # counters are not thrown away if there are no connections for this user.
disconnect mcph1; disconnect mcph1;
disconnect mcph2; disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error 1226
connect (mcph3, localhost, mysqltest_1,,); connect (mcph3, localhost, mysqltest_1,,);
# Cleanup # Cleanup
......
...@@ -2605,7 +2605,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, ...@@ -2605,7 +2605,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
uint unused_field_idx= NO_CACHED_FIELD_INDEX; uint unused_field_idx= NO_CACHED_FIELD_INDEX;
Field *f=find_field_in_table(thd, table_list, column->column.ptr(), Field *f=find_field_in_table(thd, table_list, column->column.ptr(),
column->column.ptr(), column->column.ptr(),
column->column.length(), 0, 0, 0, 0, column->column.length(), 0, 1, 1, 0,
&unused_field_idx, FALSE); &unused_field_idx, FALSE);
if (f == (Field*)0) if (f == (Field*)0)
{ {
...@@ -3359,10 +3359,6 @@ err: ...@@ -3359,10 +3359,6 @@ err:
{ {
char command[128]; char command[128];
get_privilege_desc(command, sizeof(command), want_access); get_privilege_desc(command, sizeof(command), want_access);
else if (want_access & CREATE_VIEW_ACL)
command= "create view";
else if (want_access & SHOW_VIEW_ACL)
command= "show create view";
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
command, command,
thd->priv_user, thd->priv_user,
......
...@@ -907,6 +907,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, ...@@ -907,6 +907,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
ulong counter= 0; ulong counter= 0;
Item *unused_conds= 0; Item *unused_conds= 0;
if (table_list->table)
table_list->table->insert_values=(byte *)1; // don't allocate insert_values table_list->table->insert_values=(byte *)1; // don't allocate insert_values
if ((res= mysql_prepare_insert(thd, table_list, table_list->table, if ((res= mysql_prepare_insert(thd, table_list, table_list->table,
fields, values, update_fields, fields, values, update_fields,
...@@ -933,6 +934,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, ...@@ -933,6 +934,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
res= 0; res= 0;
error: error:
lex->unit.cleanup(); lex->unit.cleanup();
if (table_list->table)
table_list->table->insert_values=0; table_list->table->insert_values=0;
DBUG_RETURN(res); DBUG_RETURN(res);
} }
...@@ -1697,7 +1699,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, ...@@ -1697,7 +1699,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
lex_end(lex); lex_end(lex);
thd->restore_backup_statement(stmt, &thd->stmt_backup); thd->restore_backup_statement(stmt, &thd->stmt_backup);
cleanup_items(stmt->free_list); cleanup_items(stmt->free_list);
cleanup_stmt_for_execute(stmt);
close_thread_tables(thd); close_thread_tables(thd);
thd->rollback_item_tree_changes(); thd->rollback_item_tree_changes();
thd->cleanup_after_query(); thd->cleanup_after_query();
...@@ -2042,7 +2043,6 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt, ...@@ -2042,7 +2043,6 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
cleanup_items(stmt->free_list); cleanup_items(stmt->free_list);
thd->rollback_item_tree_changes(); thd->rollback_item_tree_changes();
reset_stmt_params(stmt); reset_stmt_params(stmt);
cleanup_stmt_for_execute(stmt);
close_thread_tables(thd); // to close derived tables close_thread_tables(thd); // to close derived tables
thd->set_statement(&thd->stmt_backup); thd->set_statement(&thd->stmt_backup);
thd->cleanup_after_query(); thd->cleanup_after_query();
......
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