| Bug #6101 | mysqldump writes invalid SQL | ||
|---|---|---|---|
| Submitted: | 14 Oct 2004 14:45 | Modified: | 30 Nov 2004 9:07 |
| Reporter: | Paul DuBois | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: mysqldump Command-line Client | Severity: | S3 (Non-critical) |
| Version: | 4.1.x | OS: | Any (All) |
| Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[18 Oct 2004 8:48]
Ramil Kalimullin
Hi! Actually, we had this feature in the 4.1 but it was removed (probably accidentally) by Monty (bk revtool sql/sql_yacc.yy, CS 1.184.10.3, 21 Nov 2002, diff #15, merge with 4.0). Funny, but 'SHOW CREATE DATABASE IF NOT EXISTS db_name' works! So we have either to change mysqldump.c or to restore that syntax. Also we have to update the documentation. What do you think? Regards, Ramil. P.S. Bar just said that ''SHOW CREATE DATABASE *WITH* IF NOT EXISTS' syntax was discussed with Arjen and Monty.
[18 Oct 2004 17:20]
Paul DuBois
If you're asking me, I think that the proper thing is to remove the "WITH" from the statement generated by mysqldump. Allowing "WITH" requires changes to sql_yacc.yy and the manual, and is thus a more complex change, for no benefit that I can see.
[30 Nov 2004 9:07]
Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
Additional info:
fixed in 4.1.8

Description: mysqldump generates an invalid statement: On Oct 02, Paul DuBois wrote: > Beginning with MySQL 4.1.0, mysqldump.c contains code to generate a > SHOW CREATE DATABASE statement that includes a WITH IF NOT EXISTS clause: > > if (!opt_create_db) > { > char qbuf[256]; > MYSQL_ROW row; > MYSQL_RES *dbinfo; > > sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s", > qdatabase); > > if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) > { > /* Old server version, dump generic CREATE DATABASE */ > fprintf(md_result_file, > "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", > qdatabase); > } > > However, I can find no evidence that this clause is actually supported. > Is this in here for such a day as it might become legal syntax? No, it's a bug. Regards, Sergei How to repeat: See above. Suggested fix: Delete WITH IF NOT EXISTS.