diff options
author | unknown <anozdrin@mysql.com> | 2006-03-01 14:13:07 +0300 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2006-03-01 14:13:07 +0300 |
commit | a44a924a407ae1f1135a14ee750468e6fc88d9b0 (patch) | |
tree | baf54f335b2a6ccc3c2d1da9406e0832ddb6c26b /mysql-test/t/rpl_trigger.test | |
parent | 2efabfd11a6fa5621c851a472c076e4ef5184d6d (diff) | |
download | mariadb-git-a44a924a407ae1f1135a14ee750468e6fc88d9b0.tar.gz |
Fix for BUG#16266: Definer is not fully qualified error during replication.
The idea of the fix is to extend support of non-SUID triggers for backward
compatibility. Formerly non-SUID triggers were appeared when "new" server
is being started against "old" database. Now, they are also created when
"new" slave receives updates from "old" master.
mysql-test/r/rpl_trigger.result:
Updated the result file with the results of the test for BUG#16266.
mysql-test/t/rpl_trigger.test:
Added the test case for BUG#16266.
sql/mysql_priv.h:
Added an utility operation to be used from sql_yacc.yy.
sql/sql_parse.cc:
Add a utility operation to be used from sql_yacc.yy.
sql/sql_trigger.cc:
Extend support of non-SUID triggers.
sql/sql_view.cc:
Initialize LEX::definer if DEFINER-clause is missing.
sql/sql_yacc.yy:
Extended support of non-SUID triggers.
mysql-test/std_data/bug16266.000001:
A new binlog file for testing a patch for BUG#16266.
Diffstat (limited to 'mysql-test/t/rpl_trigger.test')
-rw-r--r-- | mysql-test/t/rpl_trigger.test | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test index f3db1cb5841..90822e0654c 100644 --- a/mysql-test/t/rpl_trigger.test +++ b/mysql-test/t/rpl_trigger.test @@ -162,6 +162,7 @@ use test; drop table t1,t2; drop database other; + # # Test specific triggers including SELECT into var with replication # BUG#13227: @@ -257,6 +258,79 @@ while ($rnd) } +# +# BUG#16266: Definer is not fully qualified error during replication. +# +# The idea of this test is to emulate replication of a trigger from the old +# master (master w/o "DEFINER in triggers" support) to the new slave and check +# that: +# 1. the trigger on the slave will be replicated w/o errors; +# 2. the trigger on the slave will be non-SUID (will have no DEFINER); +# 3. the trigger can be activated later on the slave w/o errors. +# +# In order to emulate this kind of replication, we make the slave playing the binlog, +# recorded by 5.0.16 master. This binlog contains the following statements: +# CREATE TABLE t1(c INT); +# CREATE TABLE t2(s CHAR(200)); +# CREATE TRIGGER trg1 AFTER INSERT ON t1 +# FOR EACH ROW +# INSERT INTO t2 VALUES(CURRENT_USER()); +# INSERT INTO t1 VALUES(1); +# + +# 1. Check that the trigger's replication is succeeded. + +# Stop the slave. + +connection slave; +STOP SLAVE; + +# Replace master's binlog. + +connection master; +FLUSH LOGS; +exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001; + +# Make the slave to replay the new binlog. + +connection slave; +RESET SLAVE; +START SLAVE; + +SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0; + +# Check that the replication succeeded. + +SHOW TABLES; +SHOW TRIGGERS; +SELECT * FROM t1; +SELECT * FROM t2; + +# 2. Check that the trigger is non-SUID on the slave; +# 3. Check that the trigger can be activated on the slave. + +INSERT INTO t1 VALUES(2); + +SELECT * FROM t1; +SELECT * FROM t2; + +# That's all, cleanup. + +DROP TRIGGER trg1; +DROP TABLE t1; +DROP TABLE t2; + +STOP SLAVE; +RESET SLAVE; + +# The master should be clean. + +connection master; +SHOW TABLES; +SHOW TRIGGERS; + +RESET MASTER; + # # End of tests |