Commit 3e49bbd8 authored by gshchepa/uchum@gleb.loc's avatar gshchepa/uchum@gleb.loc
Browse files

Fixed bug #30126.

When dumping database from a 4.x server, the mysqldump client
inserted a delimiter sign inside special commentaries of the form:
  /*!... CREATE DATABASE IF NOT EXISTS ... ;*/
During restoration that dump file was splitten by delimiter signs on
the client side, and the rest of some commentary strings was prepended
to following statements.

The 4x_server_emul test case option has been added for use with the
DBUG_EXECUTE_IF debugging macro. This option affects debug server
builds only to emulate particular behavior of a 4.x server for
the mysqldump client testing. Non-debugging builds are not affected.
parent c70dbeab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2898,7 +2898,7 @@ int init_dumping_tables(char *qdatabase)
      /* Old server version, dump generic CREATE DATABASE */
      if (opt_drop_database)
        fprintf(md_result_file,
                "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
                "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
                qdatabase);
      fprintf(md_result_file,
              "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
+4 −0
Original line number Diff line number Diff line
CREATE DATABASE mysqldump_30126;
USE mysqldump_30126;
CREATE TABLE t1 (c1 int);
DROP DATABASE mysqldump_30126;
+1 −0
Original line number Diff line number Diff line
--loose-debug=d,4x_server_emul
+13 −0
Original line number Diff line number Diff line
# Embedded server doesn't support external clients
--source include/not_embedded.inc

#
# Bug #30126: semicolon before closing */ in /*!... CREATE DATABASE ;*/
#

CREATE DATABASE mysqldump_30126;
USE mysqldump_30126;
CREATE TABLE t1 (c1 int);
--exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $MYSQLTEST_VARDIR/tmp/bug30126.sql
--exec $MYSQL mysqldump_30126 < $MYSQLTEST_VARDIR/tmp/bug30126.sql
DROP DATABASE mysqldump_30126;
+2 −0
Original line number Diff line number Diff line
@@ -3990,6 +3990,8 @@ mysql_execute_command(THD *thd)
  }
  case SQLCOM_SHOW_CREATE_DB:
  {
    DBUG_EXECUTE_IF("4x_server_emul",
                    my_error(ER_UNKNOWN_ERROR, MYF(0)); goto error;);
    if (!strip_sp(lex->name) || check_db_name(lex->name))
    {
      my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);