Current Path : /home/usr.opt/mysql57/mysql-test/suite/funcs_1/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/funcs_1/r/myisam_trig_03.result |
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; Warnings: Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. set @orig_sql_mode_session= @@SESSION.sql_mode; set @orig_sql_mode_global= @@GLOBAL.sql_mode; set GLOBAL sql_mode= (select replace(@@GLOBAL.sql_mode,'NO_AUTO_CREATE_USER','')); set SESSION sql_mode= (select replace(@@SESSION.sql_mode,'NO_AUTO_CREATE_USER','')); USE test; drop table if exists tb3; create table tb3 ( f118 char not null DEFAULT 'a', f119 char binary not null DEFAULT b'101', f120 char ascii not null DEFAULT b'101', f121 char(50), f122 char(50), f129 binary not null DEFAULT b'101', f130 tinyint not null DEFAULT 99, f131 tinyint unsigned not null DEFAULT 99, f132 tinyint zerofill not null DEFAULT 99, f133 tinyint unsigned zerofill not null DEFAULT 99, f134 smallint not null DEFAULT 999, f135 smallint unsigned not null DEFAULT 999, f136 smallint zerofill not null DEFAULT 999, f137 smallint unsigned zerofill not null DEFAULT 999, f138 mediumint not null DEFAULT 9999, f139 mediumint unsigned not null DEFAULT 9999, f140 mediumint zerofill not null DEFAULT 9999, f141 mediumint unsigned zerofill not null DEFAULT 9999, f142 int not null DEFAULT 99999, f143 int unsigned not null DEFAULT 99999, f144 int zerofill not null DEFAULT 99999, f145 int unsigned zerofill not null DEFAULT 99999, f146 bigint not null DEFAULT 999999, f147 bigint unsigned not null DEFAULT 999999, f148 bigint zerofill not null DEFAULT 999999, f149 bigint unsigned zerofill not null DEFAULT 999999, f150 decimal not null DEFAULT 999.999, f151 decimal unsigned not null DEFAULT 999.17, f152 decimal zerofill not null DEFAULT 999.999, f153 decimal unsigned zerofill, f154 decimal (0), f155 decimal (64), f156 decimal (0) unsigned, f157 decimal (64) unsigned, f158 decimal (0) zerofill, f159 decimal (64) zerofill, f160 decimal (0) unsigned zerofill, f161 decimal (64) unsigned zerofill, f162 decimal (0,0), f163 decimal (63,30), f164 decimal (0,0) unsigned, f165 decimal (63,30) unsigned, f166 decimal (0,0) zerofill, f167 decimal (63,30) zerofill, f168 decimal (0,0) unsigned zerofill, f169 decimal (63,30) unsigned zerofill, f170 numeric, f171 numeric unsigned, f172 numeric zerofill, f173 numeric unsigned zerofill, f174 numeric (0), f175 numeric (64) ) engine = <engine_to_be_used>; Warnings: Note 1265 Data truncated for column 'f150' at row 1 Note 1265 Data truncated for column 'f151' at row 1 Note 1265 Data truncated for column 'f152' at row 1 Testcase 3.5.3: --------------- drop database if exists priv_db; create database priv_db; use priv_db; create table t1 (f1 char(20)) engine= <engine_to_be_used>; create User test_noprivs@localhost; set password for test_noprivs@localhost = 'PWD'; create User test_yesprivs@localhost; set password for test_yesprivs@localhost = 'PWD'; Testcase 3.5.3.2/6: ------------------- revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant ALL on *.* to test_noprivs@localhost; revoke TRIGGER on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' Testcase 3.5.3.2: ----------------- select current_user; current_user test_noprivs@localhost use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_1-no'; ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-no'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no select current_user; current_user test_yesprivs@localhost use priv_db; create trigger trg1_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.2_2-yes'; select current_user; current_user root@localhost use priv_db; insert into t1 (f1) values ('insert 3.5.3.2-yes'); ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1' select f1 from t1 order by f1; f1 insert 3.5.3.2-no grant UPDATE on priv_db.t1 to test_yesprivs@localhost; insert into t1 (f1) values ('insert 3.5.3.2-yes'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes Testcase 3.5.3.6: ----------------- use priv_db; drop trigger trg1_2; ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1' use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-yes'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes use priv_db; drop trigger trg1_2; use priv_db; insert into t1 (f1) values ('insert 3.5.3.6-no'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes drop trigger trg1_2; Testcase 3.5.3.7a: ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant ALL on *.* to test_noprivs@localhost; revoke UPDATE on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' select current_user; current_user test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes create trigger trg4a_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1a'; insert into t1 (f1) values ('insert 3.5.3.7-1a'); ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes drop trigger trg4a_1; use priv_db; select current_user; current_user test_yesprivs@localhost show grants; Grants for test_yesprivs@localhost GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' create trigger trg4a_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2a'; insert into t1 (f1) values ('insert 3.5.3.7-2b'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a drop trigger trg4a_2; Testcase 3.5.3.7b: ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs; Warnings: Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. grant ALL on priv_db.* to test_noprivs@localhost; revoke UPDATE on priv_db.* from test_noprivs@localhost; show grants for test_noprivs; Grants for test_noprivs@% GRANT TRIGGER ON *.* TO 'test_noprivs'@'%' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant UPDATE on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' show grants; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; create trigger trg4b_1 before UPDATE on t1 for each row set new.f1 = 'trig 3.5.3.7-1b'; insert into t1 (f1) values ('insert 3.5.3.7-1b'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b'; ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a drop trigger trg4b_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4b_2 before UPDATE on t1 for each row set new.f1 = 'trig 3.5.3.7-2b'; insert into t1 (f1) values ('insert 3.5.3.7-2b'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b insert 3.5.3.7-2b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b'; select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a trig 3.5.3.7-2b drop trigger trg4b_2; Testcase 3.5.3.7c ----------------- revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs@localhost; grant ALL on priv_db.t1 to test_noprivs@localhost; revoke UPDATE on priv_db.t1 from test_noprivs@localhost; show grants for test_noprivs; Grants for test_noprivs@% GRANT TRIGGER ON *.* TO 'test_noprivs'@'%' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant UPDATE on priv_db.t1 to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; create trigger trg4c_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1c'; insert into t1 (f1) values ('insert 3.5.3.7-1c'); ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a trig 3.5.3.7-2b drop trigger trg4c_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4c_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2c'; insert into t1 (f1) values ('insert 3.5.3.7-2c'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a trig 3.5.3.7-2b trig 3.5.3.7-2c drop trigger trg4c_2; Testcase 3.5.3.7d: ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs@localhost; grant SELECT (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; show grants for test_noprivs; Grants for test_noprivs@% GRANT TRIGGER ON *.* TO 'test_noprivs'@'%' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost; show grants for test_noprivs; Grants for test_noprivs@% GRANT TRIGGER ON *.* TO 'test_noprivs'@'%' show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; create trigger trg4d_1 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-1d'; insert into t1 (f1) values ('insert 3.5.3.7-1d'); ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a trig 3.5.3.7-2b trig 3.5.3.7-2c drop trigger trg4d_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg4d_2 before INSERT on t1 for each row set new.f1 = 'trig 3.5.3.7-2d'; insert into t1 (f1) values ('insert 3.5.3.7-2d'); select f1 from t1 order by f1; f1 insert 3.5.3.2-no insert 3.5.3.6-no insert 3.5.3.7-1b trig 3.5.3.2_2-yes trig 3.5.3.2_2-yes trig 3.5.3.7-2a trig 3.5.3.7-2b trig 3.5.3.7-2c trig 3.5.3.7-2d drop trigger trg4d_2; Testcase 3.5.3.8a: ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant ALL on *.* to test_noprivs@localhost; revoke SELECT on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, SELECT on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' select current_user; current_user test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' create trigger trg5a_1 before INSERT on t1 for each row set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; select @test_var; @test_var before trig 3.5.3.8-1a insert into t1 (f1) values ('insert 3.5.3.8-1a'); ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1a drop trigger trg5a_1; use priv_db; select current_user; current_user test_yesprivs@localhost show grants; Grants for test_yesprivs@localhost GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' create trigger trg5a_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-2a'; select @test_var; @test_var before trig 3.5.3.8-2a insert into t1 (f1) values ('insert 3.5.3.8-2a'); select @test_var; @test_var insert 3.5.3.8-2a drop trigger trg5a_2; Testcase: 3.5.3.8b ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs@localhost; grant ALL on priv_db.* to test_noprivs@localhost; revoke SELECT on priv_db.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost' show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost' use priv_db; create trigger trg5b_1 before UPDATE on t1 for each row set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1b'; insert into t1 (f1) values ('insert 3.5.3.8-1b'); select @test_var; @test_var before trig 3.5.3.8-1b update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b'; ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1b drop trigger trg5b_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg5b_2 before UPDATE on t1 for each row set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-2b'; insert into t1 (f1) values ('insert 3.5.3.8-2b'); select @test_var; @test_var before trig 3.5.3.8-2b update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b'; select @test_var; @test_var update 3.5.3.8-2b drop trigger trg5b_2; Testcase 3.5.3.8c: ------------------ revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs@localhost; grant ALL on priv_db.t1 to test_noprivs@localhost; revoke SELECT on priv_db.t1 from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; create trigger trg5c_1 before INSERT on t1 for each row set @test_var= new.f1; set @test_var= 'before trig 3.5.3.8-1c'; insert into t1 (f1) values ('insert 3.5.3.8-1c'); ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1c drop trigger trg5c_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg5c_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2c'; insert into t1 (f1) values ('insert 3.5.3.8-2c'); select @test_var; @test_var insert 3.5.3.8-2c drop trigger trg5c_2; Testcase: 3.5.3.8d: ------------------- revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; grant TRIGGER on *.* to test_noprivs@localhost; grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' show grants; Grants for test_noprivs@localhost GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost' use priv_db; create trigger trg5d_1 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-1d'; insert into t1 (f1) values ('insert 3.5.3.8-1d'); ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1' select @test_var; @test_var before trig 3.5.3.8-1d drop trigger trg5d_1; show grants; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' use priv_db; create trigger trg5d_2 before INSERT on t1 for each row set @test_var= new.f1; set @test_var='before trig 3.5.3.8-2d'; insert into t1 (f1) values ('insert 3.5.3.8-2d'); select @test_var; @test_var insert 3.5.3.8-2d drop trigger trg5d_2; Testcase: 3.5.3.x: ------------------ use priv_db; drop table if exists t1; drop table if exists t2; create table t1 (f1 int) engine= <engine_to_be_used>; create table t2 (f2 int) engine= <engine_to_be_used>; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost' GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' select current_user; current_user test_yesprivs@localhost use priv_db; create trigger trg1 before insert on t1 for each row insert into t2 values (new.f1); use priv_db; insert into t1 (f1) values (4); ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2' revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant INSERT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (4); select f1 from t1 order by f1; f1 4 select f2 from t2 order by f2; f2 4 use priv_db; drop trigger trg1; create trigger trg2 before insert on t1 for each row update t2 set f2=new.f1-1; use priv_db; insert into t1 (f1) values (2); ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2' revoke INSERT on priv_db.t2 from test_yesprivs@localhost; grant UPDATE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (2); select f1 from t1 order by f1; f1 2 4 select f2 from t2 order by f2; f2 1 use priv_db; drop trigger trg2; create trigger trg3 before insert on t1 for each row select f2 into @aaa from t2 where f2=new.f1; use priv_db; insert into t1 (f1) values (1); ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2' revoke UPDATE on priv_db.t2 from test_yesprivs@localhost; grant SELECT on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); select f1 from t1 order by f1; f1 1 2 4 select f2 from t2 order by f2; f2 1 select @aaa; @aaa 1 use priv_db; drop trigger trg3; create trigger trg4 before insert on t1 for each row delete from t2; use priv_db; insert into t1 (f1) values (1); ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2' revoke SELECT on priv_db.t2 from test_yesprivs@localhost; grant DELETE on priv_db.t2 to test_yesprivs@localhost; insert into t1 (f1) values (1); select f1 from t1 order by f1; f1 1 1 2 4 select f2 from t2 order by f2; f2 drop database if exists priv_db; drop user test_yesprivs@localhost; drop user test_noprivs@localhost; drop user test_noprivs; use test; drop table tb3; set GLOBAL sql_mode= @orig_sql_mode_global; Warnings: Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. set SESSION sql_mode= @orig_sql_mode_session;