diff options
author | Michael Widenius <monty@askmonty.org> | 2011-08-10 13:08:19 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-08-10 13:08:19 +0300 |
commit | 397fc34f441c43668250dda4bb2303cbf0ace29f (patch) | |
tree | cf96738d3aba24d5b96288076381a2b599294392 /client | |
parent | cfd2725d6131ec94bb2bf4de7c607040e1611e06 (diff) | |
download | mariadb-git-397fc34f441c43668250dda4bb2303cbf0ace29f.tar.gz |
Fixes MySQL bug#48972: mysqldump --insert-ignore leaves set unique_checks=0.
This fixes a bug that when you use mysqldump --no-create-info to generate a dump that you want to merge with an existing table,
you can get an innodb table with duplicated unique keys.
Patch orignally by Eric Bergen.
client/mysqldump.c:
Only use UNIQUE_CHECKS=0 for tables that are created.
This solves the issue that you can't get duplicate unique keys when merging two dumps.
mysql-test/r/mysqldump.result:
Test for mysqldump --no-create-info
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqldump.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index aeb228dd507..ef32026987d 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -36,7 +36,7 @@ ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov */ -#define DUMP_VERSION "10.13" +#define DUMP_VERSION "10.14" #include <my_global.h> #include <my_sys.h> @@ -632,8 +632,13 @@ static void write_header(FILE *sql_file, char *db_name) if (!path) { + if (!opt_no_create_info) + { + /* We don't need unique checks as the table is created just before */ + fprintf(md_result_file,"\ +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); + } fprintf(md_result_file,"\ -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\ "); } @@ -663,8 +668,12 @@ static void write_footer(FILE *sql_file) if (!path) { fprintf(md_result_file,"\ -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\ +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n"); + if (!opt_no_create_info) + { + fprintf(md_result_file,"\ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n"); + } } if (opt_set_charset) fprintf(sql_file, |