List:Commits« Previous MessageNext Message »
From:msvensson Date:February 7 2006 6:04pm
Subject:bk commit into 5.1 tree (msvensson:1.2082)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2082 06/02/07 18:04:50 msvensson@neptunus.(none) +21 -0
  Merge neptunus.(none):/home/msvensson/mysql/mysqltest_var/my51-mysqltest_var
  into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new

  mysql-test/t/trigger-grant.test
    1.5 06/02/07 18:04:46 msvensson@neptunus.(none) +0 -3
    "Use local" when merging 5.0 -> 5.1

  mysql-test/r/mysqltest.result
    1.28 06/02/07 18:04:46 msvensson@neptunus.(none) +0 -0
    Merge 5.0 -> 5.1

  mysql-test/t/type_varchar.test
    1.8 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/trigger-compat.test
    1.5 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_replicate_do.test
    1.25 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_misc_functions.test
    1.5 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_loaddata_s.test
    1.12 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_loaddata_m.test
    1.17 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/rpl_loaddata.test
    1.24 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/query_cache.test
    1.56 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -1
    Auto merged

  mysql-test/t/mysqltest.test
    1.34 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_stm_000001.result
    1.33 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_replicate_do.result
    1.33 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_misc_functions.result
    1.4 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_loaddata_s.result
    1.10 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_loaddata_m.result
    1.19 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/rpl_loaddata.result
    1.32 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/query_cache.result
    1.71 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -1
    Auto merged

  mysql-test/mysql-test-run.sh
    1.295 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.60 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/extra/rpl_tests/rpl_stm_000001.test
    1.45 06/02/07 18:03:38 msvensson@neptunus.(none) +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-5.1-new/RESYNC

--- 1.294/mysql-test/mysql-test-run.sh	2006-01-24 15:52:45 +01:00
+++ 1.295/mysql-test/mysql-test-run.sh	2006-02-07 18:03:38 +01:00
@@ -631,7 +631,7 @@
 NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var
--ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS
--ndbd-extra-opts=$NDBD_EXTRA_OPTS"
 NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
 if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
-  USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE
--ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE"
+  USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE
--ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
 fi
 NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
 NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
@@ -1018,6 +1018,10 @@
 report_current_test () {
    tname=$1
    echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
+   eval "master1_running=\$MASTER1_RUNNING"
+   if [ x$master1_running = x1 ] ; then
+     echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
+   fi
    if [ -n "$PURIFY_LOGS" ] ; then
      for log in $PURIFY_LOGS
      do
@@ -1280,7 +1284,7 @@
     then
       NDBCLUSTER_EXTRA_OPTS="--small"
     fi
-    OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --verbose=$NDB_VERBOSE --initial
--relative-config-data-dir"
+    OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --verbose=$NDB_VERBOSE --initial
--relative-config-data-dir --core"
     if [ "x$NDB_VERBOSE" != "x0" ] ; then
       echo "Starting master ndbcluster " $OPTS
     fi
@@ -1299,7 +1303,7 @@
     NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
     echo "Using ndbcluster at $NDB_CONNECTSTRING"
   fi
-  USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
+  USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\"
--ndb-extra-logging"
   export NDB_CONNECTSTRING
   fi
 }
@@ -1513,7 +1517,7 @@
          NDBCLUSTER_EXTRA_OPTS="--small"
       fi
 
-      OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1
--verbose=$NDB_VERBOSE --relative-config-data-dir"
+      OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1
--verbose=$NDB_VERBOSE --relative-config-data-dir --core"
       if [ "x$NDB_VERBOSE" != "x0" ] ; then
         echo "Starting slave ndbcluster " $OPTS
       fi
@@ -1878,6 +1882,7 @@
      start_ndbcluster
      start_master
      if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+       echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
        start_master 1
      fi
      TZ=$MY_TZ; export TZ
@@ -1905,6 +1910,7 @@
        start_ndbcluster
        start_master
        if [ x$USING_NDBCLUSTER = x1  -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+         echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
          start_master 1
        fi
      else

--- 1.4/mysql-test/t/trigger-compat.test	2006-01-24 14:10:44 +01:00
+++ 1.5/mysql-test/t/trigger-compat.test	2006-02-07 18:03:38 +01:00
@@ -35,8 +35,7 @@
 CREATE USER mysqltest_dfn@localhost;
 CREATE USER mysqltest_inv@localhost;
 
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
+GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
 
 #
 # Create a table and the first trigger.
@@ -81,3 +80,16 @@
 --echo
 
 SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
+
+# Clean up
+DROP TRIGGER wl2818_trg1;
+DROP TRIGGER wl2818_trg2;
+disconnect wl2818_definer_con;
+connection default;
+use mysqltest_db1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP USER mysqltest_dfn@localhost;
+DROP USER mysqltest_inv@localhost;
+DROP DATABASE mysqltest_db1;
+

--- 1.4/mysql-test/t/trigger-grant.test	2006-01-24 14:10:44 +01:00
+++ 1.5/mysql-test/t/trigger-grant.test	2006-02-07 18:04:46 +01:00
@@ -8,8 +8,6 @@
 #
 # Tests for WL#2818:
 #   - Check that triggers are executed under the authorization of the definer.
-#   - Check that if trigger contains NEW/OLD variables, the definer must have
-#     SELECT privilege on the subject table.
 #   - Check DEFINER clause of CREATE TRIGGER statement;
 #     - Check that SUPER privilege required to create a trigger with different
 #       definer.
@@ -18,6 +16,8 @@
 #     - Check that the definer of a trigger does not exist, the trigger will
 #       not be activated.
 #   - Check that SHOW TRIGGERS statement provides "Definer" column.
+#   - Check that if trigger contains NEW/OLD variables, the definer must have
+#     SELECT privilege on the subject table (aka BUG#15166/BUG#15196).
 #
 #  Let's also check that user name part of definer can contain '@' symbol (to
 #  check that triggers are not affected by BUG#13310 "incorrect user parsing
@@ -44,9 +44,124 @@
 CREATE USER mysqltest_dfn@localhost;
 CREATE USER mysqltest_inv@localhost;
 
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
 GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
 
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+CREATE TABLE t1(num_value INT);
+CREATE TABLE t2(user_str TEXT);
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
+
+#
+# Check that the user must have TRIGGER privilege to create a trigger.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+  FOR EACH ROW
+    INSERT INTO t2 VALUES(CURRENT_USER());
+
+--disconnect wl2818_definer_con
+
+#
+# Check that the user must have TRIGGER privilege to drop a trigger.
+#
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+CREATE TRIGGER trg1 AFTER INSERT ON t1
+  FOR EACH ROW
+    INSERT INTO t2 VALUES(CURRENT_USER());
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+DROP TRIGGER trg1;
+
+--disconnect wl2818_definer_con
+
+#
+# Check that the definer must have TRIGGER privilege to activate a trigger.
+#
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+--error ER_TABLEACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES(0);
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
+
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+INSERT INTO t1 VALUES(0);
+
+# Cleanup for further tests.
+DROP TRIGGER trg1;
+DELETE FROM t1;
+DELETE FROM t2;
+
+--disconnect wl2818_definer_con
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
+
 #
 # Check that triggers are executed under the authorization of the definer:
 #   - create two tables under "definer";
@@ -64,9 +179,6 @@
 --echo
 --echo ---> connection: wl2818_definer_con
 
-CREATE TABLE t1(num_value INT);
-CREATE TABLE t2(user_str TEXT);
-
 CREATE TRIGGER trg1 AFTER INSERT ON t1
   FOR EACH ROW
     INSERT INTO t2 VALUES(CURRENT_USER());
@@ -143,125 +255,185 @@
 SELECT * FROM t2;
 
 #
-# Check that if trigger contains NEW/OLD variables, the definer must have
-# SELECT/UPDATE privilege on the subject table:
-#   - drop the trigger;
-#   - create a new trigger, which will use NEW variable;
-#   - create another new trigger, which will use OLD variable;
-#   - revoke SELECT/UPDATE privilege on the first table from "definer";
-#   - insert a row into the first table;
-#   - analyze error code;
-#
-
+# Check DEFINER clause of CREATE TRIGGER statement.
 #
-# SELECT privilege.
+#   - Check that SUPER privilege required to create a trigger with different
+#     definer:
+#     - try to create a trigger with DEFINER="definer@localhost" under
+#       "invoker";
+#     - analyze error code;
+#   - Check that if the user specified as DEFINER does not exist, a warning is
+#     emitted:
+#     - create a trigger with DEFINER="non_existent_user@localhost" from
+#       "definer";
+#     - check that a warning emitted;
+#   - Check that the definer of a trigger does not exist, the trigger will not
+#     be activated:
+#     - activate just created trigger;
+#     - check error code;
 #
 
+--connection wl2818_definer_con
+--echo
+--echo ---> connection: wl2818_definer_con
+
+use mysqltest_db1;
+
+DROP TRIGGER trg1;
+
+# Check that SUPER is required to specify different DEFINER.
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE DEFINER='mysqltest_inv'@'localhost'
+  TRIGGER trg1 BEFORE INSERT ON t1
+  FOR EACH ROW
+    SET @new_sum = 0;
+
 --connection default
 --echo
 --echo ---> connection: default
 
 use mysqltest_db1;
 
-REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
 
+--disconnect wl2818_definer_con
+--connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
 --connection wl2818_definer_con
 --echo
 --echo ---> connection: wl2818_definer_con
 
-use mysqltest_db1;
+CREATE DEFINER='mysqltest_inv'@'localhost'
+  TRIGGER trg1 BEFORE INSERT ON t1
+  FOR EACH ROW
+    SET @new_sum = 0;
 
-DROP TRIGGER trg1;
+# Create with non-existent user.
 
-SET @new_sum = 0;
-SET @old_sum = 0;
+CREATE DEFINER='mysqltest_nonexs'@'localhost'
+  TRIGGER trg2 AFTER INSERT ON t1
+  FOR EACH ROW
+    SET @new_sum = 0;
 
-# INSERT INTO statement; BEFORE timing
+# Check that trg2 will not be activated.
+
+# --error ER_SPECIFIC_ACCESS_DENIED_ERROR
+#
+# TODO: Due to the BUG#13198(SP executes if definer does not exist) the
+# following statement does not fail as it should.
+INSERT INTO t1 VALUES(6);
+
+#
+# Check that SHOW TRIGGERS statement provides "Definer" column.
+#
+
+SHOW TRIGGERS;
+
+#
+# Check that weird definer values do not break functionality. I.e. check the
+# following definer values:
+#   - '';
+#   - '@';
+#   - '@abc@def@@';
+#   - '@hostname';
+#   - '@abc@def@@@hostname';
+#
 
---echo ---> INSERT INTO statement; BEFORE timing
+DROP TRIGGER trg1;
+DROP TRIGGER trg2;
 
 CREATE TRIGGER trg1 BEFORE INSERT ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(4);
+    SET @a = 1;
 
-# INSERT INTO statement; AFTER timing
+CREATE TRIGGER trg2 AFTER INSERT ON t1
+  FOR EACH ROW
+    SET @a = 2;
 
---echo ---> INSERT INTO statement; AFTER timing
+CREATE TRIGGER trg3 BEFORE UPDATE ON t1
+  FOR EACH ROW
+    SET @a = 3;
 
-DROP TRIGGER trg1;
+CREATE TRIGGER trg4 AFTER UPDATE ON t1
+  FOR EACH ROW
+    SET @a = 4;
 
-CREATE TRIGGER trg1 AFTER INSERT ON t1
+CREATE TRIGGER trg5 BEFORE DELETE ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+    SET @a = 5;
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(5);
+--exec egrep -v '^definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG >
$MYSQL_TEST_DIR/var/tmp/t1.TRG
+--exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >>
$MYSQL_TEST_DIR/var/tmp/t1.TRG
+--exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG
$MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG
 
-# UPDATE statement; BEFORE timing
+--echo
 
---echo ---> UPDATE statement; BEFORE timing
+SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
 
-DROP TRIGGER trg1;
+--echo
 
-CREATE TRIGGER trg1 BEFORE UPDATE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 10;
+#
+# Cleanup
+#
 
-# UPDATE statement; AFTER timing
+--connection default
+--echo
+--echo ---> connection: default
 
---echo ---> UPDATE statement; AFTER timing
+DROP USER mysqltest_dfn@localhost;
+DROP USER mysqltest_inv@localhost;
 
-DROP TRIGGER trg1;
+DROP DATABASE mysqltest_db1;
 
-CREATE TRIGGER trg1 AFTER UPDATE ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 20;
+###########################################################################
+#
+# BUG#15166: Wrong update [was: select/update] permissions required to execute
+# triggers.
+#
+# BUG#15196: Wrong select permission required to execute triggers.
+#
+###########################################################################
 
-# DELETE statement; BEFORE timing
+#
+# Prepare environment.
+#
 
---echo ---> DELETE statement; BEFORE timing
+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 TRIGGER trg1;
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_db1;
+--enable_warnings
 
-CREATE TRIGGER trg1 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+CREATE DATABASE mysqltest_db1;
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+use mysqltest_db1;
 
-# DELETE statement; AFTER timing
+# Tables for tesing table-level privileges:
+CREATE TABLE t1(col CHAR(20)); # table for "read-value" trigger
+CREATE TABLE t2(col CHAR(20)); # table for "write-value" trigger
 
---echo ---> DELETE statement; AFTER timing
+# Tables for tesing column-level privileges:
+CREATE TABLE t3(col CHAR(20)); # table for "read-value" trigger
+CREATE TABLE t4(col CHAR(20)); # table for "write-value" trigger
 
-DROP TRIGGER trg1;
+CREATE USER mysqltest_u1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
+GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
 
-CREATE TRIGGER trg1 AFTER DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+SET @mysqltest_var = NULL;
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+--connect (bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1)
 
-#
-# UPDATE privilege
-#
-# NOTE: At the moment, UPDATE privilege is required if the trigger contains
-# NEW/OLD variables, whenever the trigger modifies them or not. Moreover,
-# UPDATE privilege is checked for whole table, not for individual columns.
-#
-# The following test cases should be changed when full support of UPDATE
-# privilege will be done.
-#
+# parsing (CREATE TRIGGER) time:
+#   - check that nor SELECT either UPDATE is required to execute triggger w/o
+#     NEW/OLD variables.
 
 --connection default
 --echo
@@ -269,207 +441,255 @@
 
 use mysqltest_db1;
 
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
+SHOW GRANTS FOR mysqltest_u1@localhost;
 
---connection wl2818_definer_con
+--connection bug15166_u1_con
 --echo
---echo ---> connection: wl2818_definer_con
+--echo ---> connection: bug15166_u1_con
 
 use mysqltest_db1;
 
-DROP TRIGGER trg1;
+CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
+  FOR EACH ROW
+    SET @mysqltest_var = 'Hello, world!';
 
-SET @new_sum = 0;
-SET @old_sum = 0;
+# parsing (CREATE TRIGGER) time:
+#   - check that UPDATE is not enough to read the value;
+#   - check that UPDATE is required to modify the value;
 
-# INSERT INTO statement; BEFORE timing
+--connection default
+--echo
+--echo ---> connection: default
 
---echo ---> INSERT INTO statement; BEFORE timing
+use mysqltest_db1;
 
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(4);
+GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
+GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
 
-# INSERT INTO statement; AFTER timing
+--connection bug15166_u1_con
+--echo
+--echo ---> connection: bug15166_u1_con
 
---echo ---> INSERT INTO statement; AFTER timing
+use mysqltest_db1;
 
-DROP TRIGGER trg1;
+# - table-level privileges
 
-CREATE TRIGGER trg1 AFTER INSERT ON t1
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+    SET @mysqltest_var = NEW.col;
+DROP TRIGGER t1_trg_err_1;
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(5);
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
+  FOR EACH ROW
+    SET @mysqltest_var = OLD.col;
+DROP TRIGGER t1_trg_err_2;
 
-# UPDATE statement; BEFORE timing
+CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
+  FOR EACH ROW
+    SET NEW.col = 't2_trg_before_insert';
 
---echo ---> UPDATE statement; BEFORE timing
+# - column-level privileges
 
-DROP TRIGGER trg1;
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+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 trg1 BEFORE UPDATE ON t1
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
   FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+    SET @mysqltest_var = OLD.col;
+DROP TRIGGER t3_trg_err_2;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 10;
+CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
+  FOR EACH ROW
+    SET NEW.col = 't4_trg_before_insert';
 
-# UPDATE statement; AFTER timing
+# parsing (CREATE TRIGGER) time:
+#   - check that SELECT is required to read the value;
+#   - check that SELECT is not enough to modify the value;
 
---echo ---> UPDATE statement; AFTER timing
+--connection default
+--echo
+--echo ---> connection: default
 
-DROP TRIGGER trg1;
+use mysqltest_db1;
 
-CREATE TRIGGER trg1 AFTER UPDATE ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+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;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 20;
+--connection bug15166_u1_con
+--echo
+--echo ---> connection: bug15166_u1_con
 
-# DELETE statement; BEFORE timing
+use mysqltest_db1;
 
---echo ---> DELETE statement; BEFORE timing
+# - table-level privileges
 
-DROP TRIGGER trg1;
+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;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+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;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+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;
+
+# - column-level privileges
+
+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;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+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;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+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;
+
+# execution time:
+#   - check that UPDATE is not enough to read the value;
+#   - check that UPDATE is required to modify the value;
 
-CREATE TRIGGER trg1 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+--connection default
+--echo
+--echo ---> connection: default
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+use mysqltest_db1;
 
-# DELETE statement; AFTER timing
+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;
 
---echo ---> DELETE statement; AFTER timing
+# - table-level privileges
 
-DROP TRIGGER trg1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES('line1');
 
-CREATE TRIGGER trg1 AFTER DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+SELECT * FROM t1;
+SELECT @mysqltest_var;
 
-#
-# Check DEFINER clause of CREATE TRIGGER statement.
-#
-# NOTE: there is no dedicated TRIGGER privilege for CREATE TRIGGER statement.
-# SUPER privilege is used instead. I.e., if one invokes CREATE TRIGGER, it should
-# have SUPER privilege, so this test is meaningless right now.
-#
-#   - Check that SUPER privilege required to create a trigger with different
-#     definer:
-#     - try to create a trigger with DEFINER="definer@localhost" under
-#       "invoker";
-#     - analyze error code;
-#   - Check that if the user specified as DEFINER does not exist, a warning is
-#     emitted:
-#     - create a trigger with DEFINER="non_existent_user@localhost" from
-#       "definer";
-#     - check that a warning emitted;
-#   - Check that the definer of a trigger does not exist, the trigger will not
-#     be activated:
-#     - activate just created trigger;
-#     - check error code;
-#
+INSERT INTO t2 VALUES('line2');
 
---connection wl2818_definer_con
---echo
---echo ---> connection: wl2818_definer_con
+SELECT * FROM t2;
 
-use mysqltest_db1;
+# - column-level privileges
 
-DROP TRIGGER trg1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t3 VALUES('t3_line1');
 
-# Check that SUPER is required to specify different DEFINER.
-# NOTE: meaningless at the moment
+SELECT * FROM t3;
+SELECT @mysqltest_var;
 
-CREATE DEFINER='mysqltest_inv'@'localhost'
-  TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = 0;
+INSERT INTO t4 VALUES('t4_line2');
 
-# Create with non-existent user.
+SELECT * FROM t4;
 
-CREATE DEFINER='mysqltest_nonexs'@'localhost'
-  TRIGGER trg2 AFTER INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = 0;
+# execution time:
+#   - check that SELECT is required to read the value;
+#   - check that SELECT is not enough to modify the value;
 
-# Check that trg2 will not be activated.
+--connection default
+--echo
+--echo ---> connection: default
 
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(6);
+use mysqltest_db1;
 
-#
-# Check that SHOW TRIGGERS statement provides "Definer" column.
-#
+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;
 
-SHOW TRIGGERS;
+# - table-level privileges
 
-#
-# Check that weird definer values do not break functionality. I.e. check the
-# following definer values:
-#   - '';
-#   - '@';
-#   - '@abc@def@@';
-#   - '@hostname';
-#   - '@abc@def@@@hostname';
-#
+INSERT INTO t1 VALUES('line3');
 
-DROP TRIGGER trg1;
-DROP TRIGGER trg2;
+SELECT * FROM t1;
+SELECT @mysqltest_var;
 
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @a = 1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t2 VALUES('line4');
 
-CREATE TRIGGER trg2 AFTER INSERT ON t1
-  FOR EACH ROW
-    SET @a = 2;
+SELECT * FROM t2;
 
-CREATE TRIGGER trg3 BEFORE UPDATE ON t1
-  FOR EACH ROW
-    SET @a = 3;
+# - column-level privileges
 
-CREATE TRIGGER trg4 AFTER UPDATE ON t1
-  FOR EACH ROW
-    SET @a = 4;
+INSERT INTO t3 VALUES('t3_line2');
 
-CREATE TRIGGER trg5 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @a = 5;
+SELECT * FROM t3;
+SELECT @mysqltest_var;
 
---exec egrep -v '^definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG >
$MYSQLTEST_VARDIR/tmp/t1.TRG
---exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >>
$MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t4 VALUES('t4_line2');
 
---echo
+SELECT * FROM t4;
 
-SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
+# execution time:
+#   - check that nor SELECT either UPDATE is required to execute triggger w/o
+#     NEW/OLD variables.
 
---echo
+DELETE FROM t1;
 
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
+SELECT @mysqltest_var;
 
 #
-# Cleanup
+# Cleanup.
 #
 
---connection default
---echo
---echo ---> connection: default
-
-DROP USER mysqltest_dfn@localhost;
-DROP USER mysqltest_inv@localhost;
+DROP USER mysqltest_u1@localhost;
 
 DROP DATABASE mysqltest_db1;

--- 1.9/mysql-test/r/rpl_loaddata_s.result	2006-01-24 13:56:44 +01:00
+++ 1.10/mysql-test/r/rpl_loaddata_s.result	2006-02-07 18:03:38 +01:00
@@ -12,3 +12,4 @@
 2
 show binlog events from 102;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+drop table t1;

--- 1.3/mysql-test/r/rpl_misc_functions.result	2006-01-24 08:30:46 +01:00
+++ 1.4/mysql-test/r/rpl_misc_functions.result	2006-02-07 18:03:38 +01:00
@@ -19,3 +19,5 @@
 select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and
t1.r2=t2.r2 and t1.p=t2.p);
 id	i	r1	r2	p	id	i	r1	r2	p
 stop slave;
+drop table t1;
+drop table t1;

--- 1.4/mysql-test/t/rpl_misc_functions.test	2006-01-24 08:30:49 +01:00
+++ 1.5/mysql-test/t/rpl_misc_functions.test	2006-02-07 18:03:38 +01:00
@@ -29,5 +29,9 @@
 # compare them with the replica; the SELECT below should return no row
 select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and
t1.r2=t2.r2 and t1.p=t2.p);
 stop slave;
+drop table t1;
+
+connection master;
+drop table t1;
 
 # End of 4.1 tests

--- 1.59/mysql-test/mysql-test-run.pl	2006-01-26 12:35:29 +01:00
+++ 1.60/mysql-test/mysql-test-run.pl	2006-02-07 18:03:38 +01:00
@@ -246,6 +246,7 @@
 our $opt_old_master;
 
 our $opt_record;
+our $opt_check_testcases;
 
 our $opt_result_ext;
 
@@ -304,11 +305,13 @@
 
 our $opt_udiff;
 
-our $opt_skip_ndbcluster;
+our $opt_skip_ndbcluster= 0;
 our $opt_with_ndbcluster;
-our $opt_skip_ndbcluster_slave;
+our $opt_skip_ndbcluster_slave= 0;
 our $opt_with_ndbcluster_slave;
-our $opt_ndb_extra_test;
+our $opt_with_ndbcluster_all= 0;
+our $opt_with_ndbcluster_only= 0;
+our $opt_ndb_extra_test= 0;
 
 our $exe_ndb_mgm;
 our $path_ndb_tools_dir;
@@ -545,6 +548,8 @@
              'with-ndbcluster-slave'    => \$opt_with_ndbcluster_slave,
              'skip-ndbcluster-slave|skip-ndb-slave'
                                         => \$opt_skip_ndbcluster_slave,
+             'with-ndbcluster-all'      => \$opt_with_ndbcluster_all,
+             'with-ndbcluster-only'     => \$opt_with_ndbcluster_only,
              'ndb-extra-test'           => \$opt_ndb_extra_test,
              'do-test=s'                => \$opt_do_test,
              'suite=s'                  => \$opt_suite,
@@ -564,6 +569,7 @@
 
              # Test case authoring
              'record'                   => \$opt_record,
+             'check-testcases'          => \$opt_check_testcases,
 
              # ???
              'mysqld=s'                 => \@opt_extra_mysqld_opt,
@@ -1411,7 +1417,8 @@
 		 "--verbose=2",
 		 $ndbcluster_opts,
 		 "--initial",
-                 "--relative-config-data-dir"],
+                 "--relative-config-data-dir",
+	         "--core"],
 		"", "", "", "") )
   {
     mtr_error("Error ndbcluster_install");
@@ -1447,7 +1454,8 @@
   if ( mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
 	       ["--port=$opt_ndbcluster_port",
 		"--data-dir=$opt_vardir",
-		"--verbose=2"],
+		"--verbose=2",
+	        "--core"],
 	       "", "/dev/null", "", "") )
   {
     mtr_error("Error ndbcluster_start");
@@ -1504,7 +1512,8 @@
 		 "--small",
 		 "--ndbd-nodes=1",
 		 "--initial",
-		 "--relative-config-data-dir"],
+		 "--relative-config-data-dir",
+		 "--core"],
 		"", "", "", "") )
   {
     mtr_error("Error ndbcluster_install_slave");
@@ -1538,7 +1547,8 @@
 	       ["--port=$opt_ndbcluster_port_slave",
 		"--data-dir=$opt_vardir",
 		"--verbose=2",
-		"--ndbd-nodes=1"],
+		"--ndbd-nodes=1",
+	        "--core"],
 	       "", "/dev/null", "", "") )
   {
     mtr_error("Error ndbcluster_start_slave");
@@ -1971,6 +1981,10 @@
   mtr_report_test_name($tinfo);
 
   mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+  if ( $master->[1]->{'pid'} )
+  {
+    mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
+  }
 
 # FIXME test cases that depend on each other, prevent this from
 # being at this location.
@@ -2019,6 +2033,7 @@
       }
       if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} )
       {
+        mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
         $master->[1]->{'pid'}=
           mysqld_start('master',1,$tinfo->{'master_opt'},[],
 		       $using_ndbcluster_master);
@@ -2349,6 +2364,7 @@
       mtr_add_arg($args, "%s--ndbcluster", $prefix);
       mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
                   $opt_ndbconnectstring);
+      mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
     }
   }
 
@@ -2420,6 +2436,7 @@
       mtr_add_arg($args, "%s--ndbcluster", $prefix);
       mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
                   $opt_ndbconnectstring_slave);
+      mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
     }
   } # end slave
 
@@ -2756,6 +2773,54 @@
   $instance_manager->{'pid'} = undef;
 }
 
+#
+# Run include/check-testcase.test
+# Before a testcase, run in record mode, save result file to var
+# After testcase, run and compare with the recorded file, they should be equal!
+#
+sub run_check_testcase ($) {
+
+  my $mode=     shift;
+
+  my $args;
+  mtr_init_args(\$args);
+
+  mtr_add_arg($args, "--no-defaults");
+  mtr_add_arg($args, "--silent");
+  mtr_add_arg($args, "-v");
+  mtr_add_arg($args, "--skip-safemalloc");
+  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
+
+  mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
+  mtr_add_arg($args, "--port=%d", $master->[0]->{'path_myport'});
+  mtr_add_arg($args, "--database=test");
+  mtr_add_arg($args, "--user=%s", $opt_user);
+  mtr_add_arg($args, "--password=");
+
+  mtr_add_arg($args, "-R");
+  mtr_add_arg($args, "$opt_vardir/tmp/check-testcase.result");
+
+  if ( $mode eq "before" )
+  {
+    mtr_add_arg($args, "--record");
+  }
+
+  my $res = mtr_run_test($exe_mysqltest,$args,
+	        "include/check-testcase.test", "", "", "");
+
+  if ( $res == 1  and $mode = "after")
+  {
+    mtr_run("diff",["-u",
+		    "$opt_vardir/tmp/check-testcase.result",
+		    "$opt_vardir/tmp/check-testcase.reject"],
+	    "", "", "", "");
+  }
+  elsif ( $res )
+  {
+    mtr_error("Could not execute 'check-testcase' $mode testcase");
+  }
+}
+
 sub run_mysqltest ($) {
   my $tinfo=       shift;
 
@@ -3009,7 +3074,18 @@
     mtr_add_arg($args, "--record");
   }
 
-  return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
+  if ( $opt_check_testcases )
+  {
+    run_check_testcase("before");
+  }
+
+  my $res = mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
+
+  if ( $opt_check_testcases )
+  {
+    run_check_testcase("after");
+  }
+  return $res;
 }
 
 
@@ -3073,7 +3149,9 @@
 Options to control what test suites or cases to run
 
   force                 Continue to run the suite after failure
-  with-ndbcluster       Use cluster, and enable test cases that requres it
+  with-ndbcluster       Use cluster, and enable test cases that requires it
+  with-ndbcluster-all   Use cluster in all tests
+  with-ndbcluster-only  Run only tests that include "ndb" in the filename
   skip-ndb[cluster]     Skip the ndb test cases, don't start cluster
   do-test=PREFIX        Run test cases which name are prefixed with PREFIX
   start-from=PREFIX     Run test cases starting from test prefixed with PREFIX
@@ -3091,6 +3169,7 @@
 Options for test case authoring
 
   record TESTNAME       (Re)genereate the result file for TESTNAME
+  check-testcases       Check testcases for sideeffects
 
 Options that pass on options
 

--- 1.27/mysql-test/r/mysqltest.result	2006-01-24 14:10:44 +01:00
+++ 1.28/mysql-test/r/mysqltest.result	2006-02-07 18:04:46 +01:00
@@ -361,6 +361,7 @@
 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/con.sql": At line 7: Connection limit
exhausted - increase MAX_CONS in mysqltest.c
 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/con.sql": At line 3: connection
'test_con1' not found in connection pool
 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/con.sql": At line 2: Connection
test_con1 already exists
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc
@@ -419,3 +420,22 @@
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'insertz error query' at line
1
 drop table t1;
 drop table t1;
+select "b" as col1, "c" as col2;
+col1	col2
+b	c
+select "b" as col1, "b" as col2, "c" as col3;
+col1	col2	col3
+b	b	c
+seled "b" bs col1, "d" bs col2;
+col1	col2
+b	d
+select "raspberry and strawberry","blackberry","tomato";
+raspberry and strawberry	blackberry	tomato
+raspberry and strawberry	blackberry	tomato
+mysqltest: At line 1: Error parsing replace_regex "a"
+mysqltest: At line 1: Error parsing replace_regex "a;"
+mysqltest: At line 1: Error parsing replace_regex "a"
+mysqltest: At line 1: Error parsing replace_regex "a "
+mysqltest: At line 1: Error parsing replace_regex "a b"
+mysqltest: At line 1: Error parsing replace_regex "/a b c"
+mysqltest: At line 1: Error parsing replace_regex "/a /b c "

--- 1.33/mysql-test/t/mysqltest.test	2006-02-07 18:02:28 +01:00
+++ 1.34/mysql-test/t/mysqltest.test	2006-02-07 18:03:38 +01:00
@@ -912,7 +912,13 @@
 --error 1
 --exec echo "source $MYSQLTEST_VARDIR/tmp/con.sql;" | $MYSQL_TEST 2>&1
 
-
+# connect when "disable_abort_on_error" caused "connection not found"
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--disable_abort_on_error
+connect (con1,localhost,root,,);
+connection default;
+connection con1;
+--enable_abort_on_error
 
 # ----------------------------------------------------------------------------
 # Test mysqltest arguments
@@ -1064,3 +1070,30 @@
 drop table t1;
 
 
+# test for replace_regex
+--replace_regex /at/b/
+select "at" as col1, "c" as col2;
+
+--replace_regex /at/b/i
+select "at" as col1, "AT" as col2, "c" as col3;
+
+--replace_regex /a/b/ /ct/d/
+select "a" as col1, "ct" as col2; 
+
+--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
+select "strawberry","blueberry","potato";
+
+--error 1
+--exec echo "--replace_regex a" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a ;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a b; echo OK;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1 

--- 1.31/mysql-test/r/rpl_loaddata.result	2006-01-26 12:35:30 +01:00
+++ 1.32/mysql-test/r/rpl_loaddata.result	2006-02-07 18:03:38 +01:00
@@ -79,3 +79,4 @@
 ERROR 23000: Duplicate entry '2003-03-22' for key 1
 drop table t2;
 drop table t2;
+drop table t1;

--- 1.7/mysql-test/t/type_varchar.test	2006-01-20 13:59:18 +01:00
+++ 1.8/mysql-test/t/type_varchar.test	2006-02-07 18:03:38 +01:00
@@ -3,7 +3,7 @@
 --enable_warnings
 
 create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
-system cp std_data/vchar.frm var/master-data/test/;
+system cp $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLTEST_VARDIR/master-data/test/;
 truncate table vchar;
 show create table t1;
 show create table vchar;

--- 1.32/mysql-test/r/rpl_replicate_do.result	2006-01-24 13:56:44 +01:00
+++ 1.33/mysql-test/r/rpl_replicate_do.result	2006-02-07 18:03:38 +01:00
@@ -40,3 +40,4 @@
 select * from t1;
 ts
 2005-08-12 00:00:00
+drop table t1;

--- 1.32/mysql-test/r/rpl_stm_000001.result	2006-01-24 13:56:44 +01:00
+++ 1.33/mysql-test/r/rpl_stm_000001.result	2006-02-07 18:03:38 +01:00
@@ -79,3 +79,4 @@
 select_priv	user
 Y	blafasel2
 drop table t1;
+delete from mysql.user where user="blafasel2";

--- 1.44/mysql-test/extra/rpl_tests/rpl_stm_000001.test	2006-01-24 13:56:43 +01:00
+++ 1.45/mysql-test/extra/rpl_tests/rpl_stm_000001.test	2006-02-07 18:03:38 +01:00
@@ -124,6 +124,7 @@
 select select_priv,user from mysql.user where user = _binary'blafasel2';
 connection master1;
 drop table t1;
+delete from mysql.user where user="blafasel2";
 save_master_pos;
 connection slave;
 sync_with_master;

--- 1.24/mysql-test/t/rpl_replicate_do.test	2006-01-24 13:56:46 +01:00
+++ 1.25/mysql-test/t/rpl_replicate_do.test	2006-02-07 18:03:38 +01:00
@@ -53,4 +53,8 @@
 set one_shot time_zone='met';
 select * from t1;
 
+connection master;
+drop table t1;
+sync_slave_with_master;
+
 # End of 4.1 tests
Thread
bk commit into 5.1 tree (msvensson:1.2082)msvensson7 Feb