summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqldump.test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-07-21 04:50:11 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-07-21 04:50:11 +0500
commitcff531ffc104179679648ee8b83f1ea74b7b376c (patch)
tree1913ff4606ea4d08e35118e7b76067075ca5fd09 /mysql-test/t/mysqldump.test
parentdb31d3c96d398930dbeb0cedfb86aaa2bd558144 (diff)
downloadmariadb-git-cff531ffc104179679648ee8b83f1ea74b7b376c.tar.gz
Fixed bug #29788.
After dumping triggers mysqldump copied the value of the OLD_SQL_MODE variable to the SQL_MODE variable. If the --compact option of the mysqldump was not set the OLD_SQL_MODE variable had the value of the uninitialized SQL_MODE variable. So usually the NO_AUTO_VALUE_ON_ZERO option of the SQL_MODE variable was discarded. This fix is for non-"--compact" mode of the mysqldump, because mysqldump --compact never set SQL_MODE to the value of NO_AUTO_VALUE_ON_ZERO. The dump_triggers_for_table function has been modified to restore previous value of the SQL_MODE variable after dumping triggers using the SAVE_SQL_MODE temporary variable. client/mysqldump.c: Fixed bug #29788. The dump_triggers_for_table function has been modified to restore previous value of the SQL_MODE variable after dumping triggers using the SAVE_SQL_MODE temporary variable. mysql-test/r/mysqldump.result: Updated test case for bug #29788. mysql-test/t/mysqldump.test: Updated test case for bug #29788.
Diffstat (limited to 'mysql-test/t/mysqldump.test')
-rw-r--r--mysql-test/t/mysqldump.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index d42162541de..3c62577e781 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1555,5 +1555,27 @@ SELECT * FROM v1;
DROP VIEW v1;
--echo #
+--echo # Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
+--echo # the SQL_MODE variable after the dumping of triggers.
+--echo #
+
+CREATE TABLE t1 (c1 INT);
+CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
+
+CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+
+SET @TMP_SQL_MODE = @@SQL_MODE;
+SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t2 VALUES (0), (1), (2);
+SET SQL_MODE = @TMP_SQL_MODE;
+SELECT * FROM t2;
+
+--exec $MYSQL_DUMP --routines test >$MYSQLTEST_VARDIR/tmp/bug29788.sql
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29788.sql
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 5.0 tests
--echo #