Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-7420

ParsingException (MariaDB Only): alterSpec drop foreign key with 'tablename.' prefix

XMLWordPrintable

    • False
    • None
    • False

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      What Debezium connector do you use and what version?

      Debezium 2.4

      What is the connector configuration?

      N/A

      What is the captured database version and mode of depoyment?

      Amazon RDS for MariaDB 10.5.21

      What behaviour do you expect?

      The following statement should be parsed successfully for mariadb -

      'alter table `table_name` drop foreign key `table_name`.`fk_column`';

      This is a valid statement in mariadb

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 8
      Server version: 10.3.39-MariaDB-1:10.3.39+maria~ubu2004 mariadb.org binary distributionCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
      
      
      MariaDB [mysql]> create table mysql.parent (`id` int not null, primary key (`id`));
      Query OK, 0 rows affected (0.013 sec) 
      
      MariaDB [mysql]> create table mysql.child (`id` int not null, primary key (`id`), parent_id int, foreign key (parent_id) references mysql.parent(id));
      Query OK, 0 rows affected (0.007 sec)
      
      -- constraint name is child_ibfk_1
      MariaDB [mysql]> alter table `child` drop foreign key `child`.`child_ibfk_1`;
      Query OK, 0 rows affected (0.005 sec)
      Records: 0  Duplicates: 0  Warnings: 0

      Although not valid in mysql

      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 8
      Server version: 8.3.0 MySQL Community Server - GPLCopyright (c) 2000, 2024, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.
      
      mysql> create table mysql.parent (`id` int not null, primary key (`id`));
      Query OK, 0 rows affected (0.04 sec)
      
      mysql> create table mysql.child (`id` int not null, primary key (`id`), parent_id int, foreign key (parent_id) references mysql.parent(id));
      Query OK, 0 rows affected (0.02 sec)
      
      -- constraint name is child_ibfk_1
      mysql> alter table `child` drop foreign key `child`.`child_ibfk_1`;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`child_ibfk_1`' at line 1

      What behaviour do you see?

      Getting the following error

      [Worker-02a326c1bc0337db3] io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'alter table `table_name` drop foreign key `table_name`.`fk_column`' 
      [Worker-02a326c1bc0337db3] mismatched input '.' expecting {<EOF>, '-'}  

      Do you see the same behaviour using the latest relesead Debezium version?

      Yes, issue also exists on latest main branch.

      Do you have the connector logs, ideally from start till finish?

      [Worker-02a326c1bc0337db3] io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'alter table `table_name` drop foreign key `table_name`.`fk_column`' 
      [Worker-02a326c1bc0337db3] mismatched input '.' expecting {<EOF>, '-'}  

       

            Unassigned Unassigned
            pricelessjunk kaustuv Chakrabarti
            kaustuv Chakrabarti
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: