1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
unknown
2007-07-21 04:50:11 +05:00
parent db31d3c96d
commit cff531ffc1
3 changed files with 60 additions and 7 deletions

View File

@ -2122,8 +2122,7 @@ static void dump_triggers_for_table(char *table,
}
if (mysql_num_rows(result))
{
if (opt_compact)
fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
fprintf(sql_file, "\n/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;\n");
fprintf(sql_file, "\nDELIMITER ;;\n");
}
while ((row= mysql_fetch_row(result)))
@ -2167,9 +2166,11 @@ static void dump_triggers_for_table(char *table,
row[3] /* Statement */);
}
if (mysql_num_rows(result))
{
fprintf(sql_file,
"DELIMITER ;\n"
"/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n");
"/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;\n");
}
mysql_free_result(result);
/*
make sure to set back opt_compatible mode to