Bug #30561 mysqldump output line of CREATE TABLE did not contain 'IF NOT EXISTS' suffix whe
Submitted: 22 Aug 2007 12:03 Modified: 19 Feb 2010 14:36
Reporter: Atanas Todorov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S4 (Feature request)
Version:mysqldump 10.12,mysql 5.1.20-beta (ia32) OS:Any
Assigned to: CPU Architecture:Any

[22 Aug 2007 12:03] Atanas Todorov
Description:
mysqldump output line of CREATE TABLE did not contain 'IF NOT EXISTS' suffix when --add-drop-table=false

When dumped with --add-drop-table=false, the first line of each create table query in the output .sql-file is:

CREATE TABLE `<table>` (
Then if I import test.sql to another mysql server where the same table(s) exist, error occures: ERROR 1050 (42S01): Table '<table>' already exists
This bug is similar to Bug #30126 - ADD_DROP_DATABASE with mysqldump problem

How to repeat:
mysqldump --host=localhost --user=root --add-drop-database=false --add-drop-table=false --databases test > test.sql

type test.sql | mysql --host=<another_host> --user=root --database=test

<another_host> is another mysql server where the same tables exist

Suggested fix:
I supose, in mysqldump.c, when --add-drop-table=false - replace 'CREATE TABLE' with 'CREATE TABLE IF NOT EXISTS'
[19 Feb 2010 14:36] Susanne Ebrecht
Many thanks for writing a reasonable feature request.