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

mysqldump incorrect identifier quoting during equality comparison

Details

    Description

      When performing queries like the one in get_table_structure(), that make use of schema object names as strings for equality comparison, we must make sure to format the string so as to escape any characters that might affect the query.

      Query:

        const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, "
                                      "`COLUMN_TYPE` AS `Type`, "
                                      "`IS_NULLABLE` AS `Null`, "
                                      "`COLUMN_KEY` AS `Key`, "
                                      "`COLUMN_DEFAULT` AS `Default`, "
                                      "`EXTRA` AS `Extra`, "
                                      "`COLUMN_COMMENT` AS `Comment` "
                                      "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
                                      "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
       
          /* ... snip ... */
          /* This needs to quote the identifiers db and table. quote_for_equal() does the job. */
          my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);

      Attachments

        Activity

          cvicentiu Vicențiu Ciorbaru created issue -
          cvicentiu Vicențiu Ciorbaru made changes -
          Field Original Value New Value
          Summary mysqldump does not quote table names correctly when performing equality comparison in all queries mysqldump incorrect identifier quoting during equality comparison
          cvicentiu Vicențiu Ciorbaru added a comment - CC: serg
          cvicentiu Vicențiu Ciorbaru added a comment - Fixed with https://github.com/MariaDB/server/commit/3839e91223528cb3435f48e13cf4832dfd009a84
          cvicentiu Vicențiu Ciorbaru made changes -
          Fix Version/s 10.1.5 [ 18813 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Component/s Scripts & Clients [ 11002 ]
          Component/s OTHER [ 10125 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 69796 ] MariaDB v4 [ 149224 ]

          People

            cvicentiu Vicențiu Ciorbaru
            cvicentiu Vicențiu Ciorbaru
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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