[MDEV-8248] mysqldump incorrect identifier quoting during equality comparison Created: 2015-05-30  Updated: 2015-06-01  Resolved: 2015-05-30

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.1
Fix Version/s: 10.1.5

Type: Bug Priority: Major
Reporter: Vicențiu Ciorbaru Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None


 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);



 Comments   
Comment by Vicențiu Ciorbaru [ 2015-05-30 ]

CC: serg

Comment by Vicențiu Ciorbaru [ 2015-05-30 ]

Fixed with
https://github.com/MariaDB/server/commit/3839e91223528cb3435f48e13cf4832dfd009a84

Generated at Thu Feb 08 07:25:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.