[MDEV-28391] table_exists procedure fails when arguments contain escaped backticks as an quoted identifiers Created: 2022-04-22  Updated: 2022-05-12  Resolved: 2022-05-04

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table, Server
Affects Version/s: 10.6, 10.7, 10.8
Fix Version/s: 10.6.8, 10.7.4, 10.8.3, 10.9.1

Type: Bug Priority: Major
Reporter: Anel Husakovic Assignee: Anel Husakovic
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-28342 sys.create_synonym_db fails when a te... Closed

 Description   
  • It fails with quoted identifiers (exepcted output empty)

    MariaDB [test]> CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10));
    MariaDB [test]> show create table `ab``c`;
    +-------+-------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                              |
    +-------+-------------------------------------------------------------------------------------------+
    | ab`c  | CREATE TABLE `ab``c` (
      `i` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 |
    +-------+-------------------------------------------------------------------------------------------+
    1 row in set (0.000 sec)
     
    MariaDB [test]> call sys.table_exists('test', '`ab``c`',@type);
    ERROR 1103 (42000): Incorrect table name ''
    

  • It even fails with valid table name (after removing enveloped and escaped backtick qoute) - expected output type of the table:

    MariaDB [test]> call sys.table_exists('test','ab`c', @ext);
    ERROR 1064 (42000): 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 '` (id INT PRIMARY KEY)' at line 1
    



 Comments   
Comment by Anel Husakovic [ 2022-04-22 ]

Hi wlad can you please review https://github.com/MariaDB/server/commit/a2238dc96382a384071e7c93b2cc52bf260b0d6c

Comment by Vladislav Vaintroub [ 2022-04-28 ]

Looks good to me.

Comment by Anel Husakovic [ 2022-05-04 ]

Closed with 06a4193cc30d67

Generated at Thu Feb 08 10:00:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.