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

Client with cp1256 loses the trailing backtick

    XMLWordPrintable

Details

    Description

      --exec $MYSQL test -e '\C cp1256 ; DROP TABLE IF EXISTS `t`'
      --echo # Success
      

      10.5 3d4174762

      ERROR 1064 (42000) at line 1: 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 '`t' at line 1
      mysqltest: At line 1: exec of '/10.5/client//mariadb --defaults-file=/10.5/mysql-test/var/my.cnf test -e '\C cp1256 ; DROP TABLE IF EXISTS `t`'' failed, error: 256, status: 1, errno: 11
      

      The general log reveals that the server didn't receive the second backtick:

      4 Connect  root@localhost on test using Socket
      4 Query    SET NAMES cp1256
      4 Query    DROP TABLE IF EXISTS `t
      4 Quit     
      

      I couldn't achieve the same effect by replacing the client \C command with SET NAMES.

      The issue is not limited to the intentional explicit use of the command. The test case originates from mysqlbinlog output which I tried to replay:

      SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
      /*!\C cp1256 *//*!*/;
      SET @@session.character_set_client=cp1256,@@session.collation_connection=57,@@session.collation_server=57/*!*/;
      ...
      DROP TABLE IF EXISTS `t001` /* generated by server */
      

      which ended with a syntax error.

      Reproducible with all existing versions, also with (at least) MySQL 8.0.35.

      Attachments

        Activity

          People

            bar Alexander Barkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.