summaryrefslogtreecommitdiff
path: root/mysql-test/t/trigger-compat.test
diff options
context:
space:
mode:
authorPatrick Crews <patrick.crews@sun.com>2009-02-19 18:24:25 -0500
committerPatrick Crews <patrick.crews@sun.com>2009-02-19 18:24:25 -0500
commite9b4b536f39d459b51c6b3db308be809003c7210 (patch)
treecdb649a4f978cf26309509f0be874d043fa91bb9 /mysql-test/t/trigger-compat.test
parent901427b2413a8f8c80b4720969d101357da57556 (diff)
parentcf571967ad8625643e0a7251e20246207cee46a9 (diff)
downloadmariadb-git-e9b4b536f39d459b51c6b3db308be809003c7210.tar.gz
merge 5.0 -> 5.1
These are only 5.0's fixes being merged. 5.1 and 6.0 Unix-removals will occur in different patches.
Diffstat (limited to 'mysql-test/t/trigger-compat.test')
-rw-r--r--mysql-test/t/trigger-compat.test25
1 files changed, 19 insertions, 6 deletions
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index bf119cd89e6..2cc86692d0d 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -49,9 +49,7 @@ GRANT CREATE, TRIGGER 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.
@@ -60,9 +58,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/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);
+let $MYSQLD_DATADIR = `select @@datadir`;
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch;
+# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
+--remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
+eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
+ '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG'
+FROM patch;
+DROP TABLE patch;
+--connection wl2818_definer_con
+--enable_query_log
#
# Create a new trigger.