summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger-compat.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/trigger-compat.test')
-rw-r--r--mysql-test/t/trigger-compat.test24
1 files changed, 19 insertions, 5 deletions
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index f2e350cb161..db410ba2f18 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
@@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+# Here we remove definers. This is somewhat complex than the original test
+# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
+# portable and we have to load the file into a table, exclude the definers line,
+# then load the data to an outfile to accomplish the same effect
+
+--disable_query_log
+--connection default
+CREATE TABLE patch (a blob);
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch;
+# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
+--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
+ '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG'
+FROM patch;
+DROP TABLE patch;
+--connection wl2818_definer_con
+--enable_query_log
+
#
# Create a new trigger.