2005-11-10 20:25:03 +01:00
|
|
|
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 IF EXISTS mysqltest_db1;
|
|
|
|
CREATE DATABASE mysqltest_db1;
|
|
|
|
CREATE USER mysqltest_dfn@localhost;
|
|
|
|
CREATE USER mysqltest_inv@localhost;
|
|
|
|
GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
CREATE TABLE t1(num_value INT);
|
|
|
|
CREATE TABLE t2(user_str TEXT);
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connection default;
|
2006-11-21 09:25:10 +01:00
|
|
|
GRANT INSERT, DROP ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
|
|
|
GRANT INSERT, DROP ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
INSERT INTO t2 VALUES(CURRENT_USER());
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1`
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
INSERT INTO t2 VALUES(CURRENT_USER());
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
DROP TRIGGER trg1;
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1`
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
INSERT INTO t1 VALUES(0);
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t1`
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
INSERT INTO t1 VALUES(0);
|
|
|
|
DROP TRIGGER trg1;
|
2006-06-01 11:53:27 +02:00
|
|
|
TRUNCATE TABLE t1;
|
|
|
|
TRUNCATE TABLE t2;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
INSERT INTO t2 VALUES(CURRENT_USER());
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2005-11-10 20:25:03 +01:00
|
|
|
GRANT ALL PRIVILEGES ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
|
|
|
GRANT ALL PRIVILEGES ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
|
|
|
|
GRANT ALL PRIVILEGES ON mysqltest_db1.t1
|
|
|
|
TO 'mysqltest_inv'@localhost;
|
|
|
|
GRANT SELECT ON mysqltest_db1.t2
|
|
|
|
TO 'mysqltest_inv'@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection wl2818_definer_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
SELECT * FROM t1;
|
|
|
|
num_value
|
|
|
|
1
|
|
|
|
SELECT * FROM t2;
|
|
|
|
user_str
|
|
|
|
mysqltest_dfn@localhost
|
2016-03-25 17:51:22 +01:00
|
|
|
connect wl2818_invoker_con,localhost,mysqltest_inv,,mysqltest_db1;
|
|
|
|
connection wl2818_invoker_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
INSERT INTO t1 VALUES(2);
|
|
|
|
SELECT * FROM t1;
|
|
|
|
num_value
|
|
|
|
1
|
|
|
|
2
|
|
|
|
SELECT * FROM t2;
|
|
|
|
user_str
|
|
|
|
mysqltest_dfn@localhost
|
|
|
|
mysqltest_dfn@localhost
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2005-11-10 20:25:03 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection wl2818_invoker_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
INSERT INTO t1 VALUES(3);
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: INSERT command denied to user 'mysqltest_dfn'@'localhost' for table `mysqltest_db1`.`t2`
|
2005-11-10 20:25:03 +01:00
|
|
|
SELECT * FROM t1;
|
|
|
|
num_value
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
SELECT * FROM t2;
|
|
|
|
user_str
|
|
|
|
mysqltest_dfn@localhost
|
|
|
|
mysqltest_dfn@localhost
|
2016-03-25 17:51:22 +01:00
|
|
|
connection wl2818_definer_con;
|
2005-11-10 20:25:03 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
DROP TRIGGER trg1;
|
|
|
|
CREATE DEFINER='mysqltest_inv'@'localhost'
|
|
|
|
TRIGGER trg1 BEFORE INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @new_sum = 0;
|
2020-02-28 18:59:01 +01:00
|
|
|
ERROR 42000: Access denied; you need (at least one of) the SUPER, SET USER privilege(s) for this operation
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-02-01 11:28:45 +01:00
|
|
|
use mysqltest_db1;
|
2020-02-28 18:59:01 +01:00
|
|
|
GRANT SET USER ON *.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect wl2818_definer_con;
|
|
|
|
connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connection wl2818_definer_con;
|
2006-02-01 11:28:45 +01:00
|
|
|
CREATE DEFINER='mysqltest_inv'@'localhost'
|
|
|
|
TRIGGER trg1 BEFORE INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @new_sum = 0;
|
2005-11-10 20:25:03 +01:00
|
|
|
CREATE DEFINER='mysqltest_nonexs'@'localhost'
|
|
|
|
TRIGGER trg2 AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @new_sum = 0;
|
|
|
|
Warnings:
|
2008-03-22 09:01:31 +01:00
|
|
|
Note 1449 The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
|
2005-11-10 20:25:03 +01:00
|
|
|
INSERT INTO t1 VALUES(6);
|
2008-03-22 09:01:31 +01:00
|
|
|
ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
|
2005-11-10 20:25:03 +01:00
|
|
|
SHOW TRIGGERS;
|
Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
|
|
|
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
2017-02-08 21:28:00 +01:00
|
|
|
trg1 INSERT t1 SET @new_sum = 0 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
|
|
|
trg2 INSERT t1 SET @new_sum = 0 AFTER # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
2005-11-10 20:25:03 +01:00
|
|
|
DROP TRIGGER trg1;
|
|
|
|
DROP TRIGGER trg2;
|
|
|
|
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @a = 1;
|
|
|
|
CREATE TRIGGER trg2 AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @a = 2;
|
|
|
|
CREATE TRIGGER trg3 BEFORE UPDATE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @a = 3;
|
|
|
|
CREATE TRIGGER trg4 AFTER UPDATE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @a = 4;
|
|
|
|
CREATE TRIGGER trg5 BEFORE DELETE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @a = 5;
|
|
|
|
|
|
|
|
SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
|
|
|
|
trigger_name definer
|
|
|
|
trg1
|
|
|
|
trg2 @
|
2013-10-18 21:17:49 +02:00
|
|
|
trg3 @abc@def@@%
|
2005-11-10 20:25:03 +01:00
|
|
|
trg4 @hostname
|
|
|
|
trg5 @abcdef@@@hostname
|
|
|
|
|
|
|
|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
|
Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
|
|
|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
|
2017-02-08 21:28:00 +01:00
|
|
|
def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
|
|
|
|
def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 1 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @ latin1 latin1_swedish_ci latin1_swedish_ci
|
|
|
|
def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci
|
|
|
|
def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @hostname latin1 latin1_swedish_ci latin1_swedish_ci
|
|
|
|
def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 1 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2005-11-10 20:25:03 +01:00
|
|
|
DROP USER mysqltest_dfn@localhost;
|
|
|
|
DROP USER mysqltest_inv@localhost;
|
|
|
|
DROP DATABASE mysqltest_db1;
|
2006-01-24 18:15:12 +01:00
|
|
|
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 IF EXISTS mysqltest_db1;
|
|
|
|
CREATE DATABASE mysqltest_db1;
|
|
|
|
use mysqltest_db1;
|
|
|
|
CREATE TABLE t1(col CHAR(20));
|
|
|
|
CREATE TABLE t2(col CHAR(20));
|
|
|
|
CREATE TABLE t3(col CHAR(20));
|
|
|
|
CREATE TABLE t4(col CHAR(20));
|
|
|
|
CREATE USER mysqltest_u1@localhost;
|
|
|
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
|
2006-02-06 14:05:20 +01:00
|
|
|
GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
2006-01-24 18:15:12 +01:00
|
|
|
SET @mysqltest_var = NULL;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1;
|
|
|
|
connection default;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
|
|
|
SHOW GRANTS FOR mysqltest_u1@localhost;
|
|
|
|
Grants for mysqltest_u1@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT USAGE ON *.* TO `mysqltest_u1`@`localhost`
|
|
|
|
GRANT DELETE, TRIGGER ON `mysqltest_db1`.* TO `mysqltest_u1`@`localhost`
|
2016-03-25 17:51:22 +01:00
|
|
|
connection bug15166_u1_con;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = 'Hello, world!';
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection bug15166_u1_con;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = NEW.col;
|
|
|
|
DROP TRIGGER t1_trg_err_1;
|
|
|
|
CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = OLD.col;
|
|
|
|
DROP TRIGGER t1_trg_err_2;
|
|
|
|
CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = 't2_trg_before_insert';
|
|
|
|
CREATE TRIGGER t3_trg_err_1 BEFORE INSERT ON t3
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = NEW.col;
|
|
|
|
DROP TRIGGER t3_trg_err_1;
|
|
|
|
CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = OLD.col;
|
|
|
|
DROP TRIGGER t3_trg_err_2;
|
|
|
|
CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = 't4_trg_before_insert';
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT(col) on mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT(col) on mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection bug15166_u1_con;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = NEW.col;
|
|
|
|
CREATE TRIGGER t1_trg_after_update AFTER UPDATE ON t1
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = OLD.col;
|
|
|
|
CREATE TRIGGER t2_trg_err_1 BEFORE UPDATE ON t2
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = 't2_trg_err_1';
|
|
|
|
DROP TRIGGER t2_trg_err_1;
|
|
|
|
CREATE TRIGGER t2_trg_err_2 BEFORE UPDATE ON t2
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
|
|
|
DROP TRIGGER t2_trg_err_2;
|
|
|
|
CREATE TRIGGER t3_trg_after_insert AFTER INSERT ON t3
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = NEW.col;
|
|
|
|
CREATE TRIGGER t3_trg_after_update AFTER UPDATE ON t3
|
|
|
|
FOR EACH ROW
|
|
|
|
SET @mysqltest_var = OLD.col;
|
|
|
|
CREATE TRIGGER t4_trg_err_1 BEFORE UPDATE ON t4
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = 't4_trg_err_1';
|
|
|
|
DROP TRIGGER t4_trg_err_1;
|
|
|
|
CREATE TRIGGER t4_trg_err_2 BEFORE UPDATE ON t4
|
|
|
|
FOR EACH ROW
|
|
|
|
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
|
|
|
DROP TRIGGER t4_trg_err_2;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE SELECT ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
|
|
|
REVOKE SELECT(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE SELECT(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
|
|
|
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
|
|
|
INSERT INTO t1 VALUES('line1');
|
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't1'
|
|
|
|
SELECT * FROM t1;
|
|
|
|
col
|
|
|
|
line1
|
|
|
|
SELECT @mysqltest_var;
|
|
|
|
@mysqltest_var
|
|
|
|
NULL
|
|
|
|
INSERT INTO t2 VALUES('line2');
|
|
|
|
SELECT * FROM t2;
|
|
|
|
col
|
|
|
|
t2_trg_before_insert
|
|
|
|
INSERT INTO t3 VALUES('t3_line1');
|
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't3'
|
|
|
|
SELECT * FROM t3;
|
|
|
|
col
|
|
|
|
t3_line1
|
|
|
|
SELECT @mysqltest_var;
|
|
|
|
@mysqltest_var
|
|
|
|
NULL
|
|
|
|
INSERT INTO t4 VALUES('t4_line2');
|
|
|
|
SELECT * FROM t4;
|
|
|
|
col
|
|
|
|
t4_trg_before_insert
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-01-24 18:15:12 +01:00
|
|
|
use mysqltest_db1;
|
|
|
|
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
|
|
|
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
|
|
|
GRANT SELECT(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
|
|
|
INSERT INTO t1 VALUES('line3');
|
|
|
|
SELECT * FROM t1;
|
|
|
|
col
|
|
|
|
line1
|
|
|
|
line3
|
|
|
|
SELECT @mysqltest_var;
|
|
|
|
@mysqltest_var
|
|
|
|
line3
|
|
|
|
INSERT INTO t2 VALUES('line4');
|
|
|
|
ERROR 42000: UPDATE command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't2'
|
|
|
|
SELECT * FROM t2;
|
|
|
|
col
|
|
|
|
t2_trg_before_insert
|
|
|
|
INSERT INTO t3 VALUES('t3_line2');
|
|
|
|
SELECT * FROM t3;
|
|
|
|
col
|
|
|
|
t3_line1
|
|
|
|
t3_line2
|
|
|
|
SELECT @mysqltest_var;
|
|
|
|
@mysqltest_var
|
|
|
|
t3_line2
|
|
|
|
INSERT INTO t4 VALUES('t4_line2');
|
|
|
|
ERROR 42000: UPDATE command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't4'
|
|
|
|
SELECT * FROM t4;
|
|
|
|
col
|
|
|
|
t4_trg_before_insert
|
|
|
|
DELETE FROM t1;
|
|
|
|
SELECT @mysqltest_var;
|
|
|
|
@mysqltest_var
|
|
|
|
Hello, world!
|
|
|
|
DROP USER mysqltest_u1@localhost;
|
|
|
|
DROP DATABASE mysqltest_db1;
|
2006-05-12 11:55:21 +02:00
|
|
|
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 IF EXISTS mysqltest_db1;
|
|
|
|
CREATE DATABASE mysqltest_db1;
|
|
|
|
USE mysqltest_db1;
|
|
|
|
CREATE TABLE t1 (i1 INT);
|
|
|
|
CREATE TABLE t2 (i1 INT);
|
|
|
|
CREATE USER mysqltest_dfn@localhost;
|
|
|
|
CREATE USER mysqltest_inv@localhost;
|
2006-05-18 13:35:15 +02:00
|
|
|
GRANT EXECUTE, CREATE ROUTINE, TRIGGER ON *.* TO mysqltest_dfn@localhost;
|
2006-05-12 11:55:21 +02:00
|
|
|
GRANT INSERT ON mysqltest_db1.* TO mysqltest_inv@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect definer,localhost,mysqltest_dfn,,mysqltest_db1;
|
|
|
|
connect invoker,localhost,mysqltest_inv,,mysqltest_db1;
|
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE PROCEDURE p1(OUT i INT) DETERMINISTIC NO SQL SET i = 3;
|
|
|
|
CREATE PROCEDURE p2(INOUT i INT) DETERMINISTIC NO SQL SET i = i * 5;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
|
|
|
CALL p1(NEW.i1);
|
|
|
|
CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
|
|
|
|
CALL p2(NEW.i1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (7);
|
|
|
|
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
|
|
|
|
INSERT INTO t2 VALUES (11);
|
fixes for test failures
and small collateral changes
mysql-test/lib/My/Test.pm:
somehow with "print" we get truncated writes sometimes
mysql-test/suite/perfschema/r/digest_table_full.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/dml_handler.result:
host table is not ported over yet
mysql-test/suite/perfschema/r/information_schema.result:
host table is not ported over yet
mysql-test/suite/perfschema/r/nesting.result:
this differs, because we don't rewrite general log queries, and multi-statement
packets are logged as a one entry. this result file is identical to what mysql-5.6.5
produces with the --log-raw option.
mysql-test/suite/perfschema/r/relaylog.result:
MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
mysql-test/suite/perfschema/r/server_init.result:
MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
mysql-test/suite/perfschema/r/stage_mdl_global.result:
this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
do that, and this causes useless mutex locks and waits.
mysql-test/suite/perfschema/r/statement_digest.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_consumers.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_long_query.result:
md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
2012-09-27 20:09:46 +02:00
|
|
|
ERROR 42000: SELECT, UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP TRIGGER t2_bi;
|
|
|
|
DROP TRIGGER t1_bi;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
GRANT SELECT ON mysqltest_db1.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
|
|
|
CALL p1(NEW.i1);
|
|
|
|
CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
|
|
|
|
CALL p2(NEW.i1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (13);
|
|
|
|
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
|
|
|
|
INSERT INTO t2 VALUES (17);
|
|
|
|
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
REVOKE SELECT ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP TRIGGER t2_bi;
|
|
|
|
DROP TRIGGER t1_bi;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
GRANT UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
|
|
|
CALL p1(NEW.i1);
|
|
|
|
CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
|
|
|
|
CALL p2(NEW.i1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (19);
|
|
|
|
INSERT INTO t2 VALUES (23);
|
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP TRIGGER t2_bi;
|
|
|
|
DROP TRIGGER t1_bi;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
GRANT SELECT, UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
|
|
|
CALL p1(NEW.i1);
|
|
|
|
CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
|
|
|
|
CALL p2(NEW.i1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (29);
|
|
|
|
INSERT INTO t2 VALUES (31);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
REVOKE SELECT, UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP TRIGGER t2_bi;
|
|
|
|
DROP TRIGGER t1_bi;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP PROCEDURE p2;
|
|
|
|
DROP PROCEDURE p1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
GRANT UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
CREATE PROCEDURE p1(OUT i INT) DETERMINISTIC NO SQL SET i = 37;
|
|
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
|
|
|
CALL p1(NEW.i1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (41);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
CREATE PROCEDURE p1(IN i INT) DETERMINISTIC NO SQL SET @v1 = i + 43;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (47);
|
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
CREATE PROCEDURE p1(INOUT i INT) DETERMINISTIC NO SQL SET i = i + 51;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection invoker;
|
2006-05-12 11:55:21 +02:00
|
|
|
INSERT INTO t1 VALUES (53);
|
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection definer;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP TRIGGER t1_bi;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect definer;
|
|
|
|
disconnect invoker;
|
|
|
|
connection default;
|
2006-05-12 11:55:21 +02:00
|
|
|
DROP USER mysqltest_inv@localhost;
|
|
|
|
DROP USER mysqltest_dfn@localhost;
|
|
|
|
DROP TABLE t2;
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP DATABASE mysqltest_db1;
|
|
|
|
USE test;
|
2010-01-12 09:19:48 +01:00
|
|
|
CREATE TABLE t1 (id INTEGER);
|
|
|
|
CREATE TABLE t2 (id INTEGER);
|
|
|
|
INSERT INTO t2 VALUES (1),(2);
|
|
|
|
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
|
|
|
|
INSERT INTO t2 VALUES (new.id);
|
2016-03-25 17:51:22 +01:00
|
|
|
CONNECT rl_holder, localhost, root,,;
|
|
|
|
CONNECT rl_acquirer, localhost, root,,;
|
|
|
|
CONNECT wl_acquirer, localhost, root,,;
|
|
|
|
CONNECT rl_contender, localhost, root,,;
|
|
|
|
connection rl_holder;
|
2010-01-12 09:19:48 +01:00
|
|
|
SELECT GET_LOCK('B26162',120);
|
|
|
|
GET_LOCK('B26162',120)
|
|
|
|
1
|
2016-03-25 17:51:22 +01:00
|
|
|
connection rl_acquirer;
|
2010-01-12 09:19:48 +01:00
|
|
|
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection wl_acquirer;
|
2010-01-12 09:19:48 +01:00
|
|
|
SET SESSION LOW_PRIORITY_UPDATES=1;
|
|
|
|
SET GLOBAL LOW_PRIORITY_UPDATES=1;
|
|
|
|
INSERT INTO t1 VALUES (5);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection rl_contender;
|
2010-01-12 09:19:48 +01:00
|
|
|
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection rl_holder;
|
2010-01-12 09:19:48 +01:00
|
|
|
SELECT RELEASE_LOCK('B26162');
|
|
|
|
RELEASE_LOCK('B26162')
|
|
|
|
1
|
2016-03-25 17:51:22 +01:00
|
|
|
connection rl_acquirer;
|
2010-01-12 09:19:48 +01:00
|
|
|
rl_acquirer GET_LOCK('B26162',120) id
|
|
|
|
rl_acquirer 1 1
|
|
|
|
SELECT RELEASE_LOCK('B26162');
|
|
|
|
RELEASE_LOCK('B26162')
|
|
|
|
1
|
2016-03-25 17:51:22 +01:00
|
|
|
connection wl_acquirer;
|
|
|
|
connection rl_contender;
|
2010-01-12 09:19:48 +01:00
|
|
|
rl_contender id
|
|
|
|
rl_contender 2
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
|
|
|
disconnect rl_acquirer;
|
|
|
|
disconnect wl_acquirer;
|
|
|
|
disconnect rl_contender;
|
|
|
|
disconnect rl_holder;
|
2010-01-12 09:19:48 +01:00
|
|
|
DROP TRIGGER t1_test;
|
|
|
|
DROP TABLE t1,t2;
|
|
|
|
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
|
|
|
|
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
|
2006-05-12 11:55:21 +02:00
|
|
|
End of 5.0 tests.
|
2007-12-12 22:44:14 +01:00
|
|
|
drop table if exists t1;
|
|
|
|
create table t1 (i int);
|
2016-03-25 17:51:22 +01:00
|
|
|
connect flush,localhost,root,,test,,;
|
|
|
|
connection default;
|
2007-12-12 22:44:14 +01:00
|
|
|
lock tables t1 write;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection flush;
|
2007-12-12 22:44:14 +01:00
|
|
|
flush tables with read lock;;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2007-12-12 22:44:14 +01:00
|
|
|
create trigger t1_bi before insert on t1 for each row begin end;
|
|
|
|
unlock tables;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection flush;
|
2007-12-12 22:44:14 +01:00
|
|
|
unlock tables;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2007-12-12 22:44:14 +01:00
|
|
|
select * from t1;
|
|
|
|
i
|
|
|
|
drop table t1;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect flush;
|
2009-06-25 12:52:50 +02:00
|
|
|
CREATE DATABASE db1;
|
|
|
|
CREATE TABLE db1.t1 (a char(30)) ENGINE=MEMORY;
|
|
|
|
CREATE TRIGGER db1.trg AFTER INSERT ON db1.t1 FOR EACH ROW
|
|
|
|
INSERT INTO db1.t1 VALUES('Some very sensitive data goes here');
|
|
|
|
CREATE USER 'no_rights'@'localhost';
|
|
|
|
REVOKE ALL ON *.* FROM 'no_rights'@'localhost';
|
|
|
|
FLUSH PRIVILEGES;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con1,localhost,no_rights,,;
|
2009-06-25 12:52:50 +02:00
|
|
|
SELECT trigger_name FROM INFORMATION_SCHEMA.TRIGGERS
|
|
|
|
WHERE trigger_schema = 'db1';
|
|
|
|
trigger_name
|
|
|
|
SHOW CREATE TRIGGER db1.trg;
|
2009-10-02 11:12:10 +02:00
|
|
|
ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
|
|
|
disconnect con1;
|
2009-06-25 12:52:50 +02:00
|
|
|
DROP USER 'no_rights'@'localhost';
|
|
|
|
DROP DATABASE db1;
|
2010-09-07 10:53:46 +02:00
|
|
|
DROP DATABASE IF EXISTS mysqltest_db1;
|
|
|
|
CREATE DATABASE mysqltest_db1;
|
|
|
|
USE mysqltest_db1;
|
2015-08-11 18:45:38 +02:00
|
|
|
CREATE USER mysqltest_u1@localhost;
|
2010-09-07 10:53:46 +02:00
|
|
|
GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con1,localhost,mysqltest_u1,,mysqltest_db1;
|
2010-09-07 10:53:46 +02:00
|
|
|
CREATE TABLE t1 (
|
|
|
|
a1 int,
|
|
|
|
a2 int
|
|
|
|
);
|
|
|
|
INSERT INTO t1 VALUES (1, 20);
|
|
|
|
CREATE TRIGGER mysqltest_db1.upd_t1
|
|
|
|
BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200;
|
|
|
|
CREATE TABLE t2 (
|
|
|
|
a1 int
|
|
|
|
);
|
|
|
|
INSERT INTO t2 VALUES (2);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-09-07 10:53:46 +02:00
|
|
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
|
|
|
|
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t1`
|
2010-09-07 10:53:46 +02:00
|
|
|
DROP DATABASE mysqltest_db1;
|
|
|
|
DROP USER mysqltest_u1@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect con1;
|
|
|
|
connection default;
|
2010-09-07 10:53:46 +02:00
|
|
|
USE test;
|
2007-11-29 12:42:26 +01:00
|
|
|
End of 5.1 tests.
|