Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30295

mysqldump produces syntactically incorrect statement

    XMLWordPrintable

Details

    Description

      If a trigger contains a comment in its description, it can interleave with executable comments which mysqldump adds, resulting in syntactically incorrect statement and unloadable dump.

      create table t (a int);
      create trigger /* here */ tr after insert on t for each row set @a=1;
       
      --exec $MYSQL_DUMP test > $MYSQL_TMP_DIR/test.dump
      --exec $MYSQL test < $MYSQL_TMP_DIR/test.dump
       
      # Cleanup
      drop table t;
      

      10.3 0ca3aaa7

      ERROR 1064 (42000) at line 47: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
      mysqltest: At line 5: exec of '/mnt8t/bld/10.3-nightly/bin/mysql --defaults-file=/mnt8t/bld/10.3-nightly/mysql-test/var/my.cnf test < /mnt8t/bld/10.3-nightly/mysql-test/var/tmp/test.dump' failed, error: 256, status: 1, errno: 11
      

      The line 47 which it complains about it

      /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger /* here */ tr after insert on t for each row set @a=1 */;;
      

      Note the comment /* here */ nested inside the executable comment.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.