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

Casting as INT causes a ParsingError

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.2.0.CR1
    • 1.2.0.Beta2
    • mysql-connector
    • None
    • Hide

      Post a mysql connector to an empty database and run the CREATE PROCEDURE in the description.

      Show
      Post a mysql connector to an empty database and run the CREATE PROCEDURE in the description.

    Description

      On an empty MySQL database, running this code:

      CREATE PROCEDURE `myprocedure` (IN param1 VARCHAR(255), IN param2 INT)
      BEGIN
          INSERT INTO some_table (some_column) VALUES (CAST('32' as INT));
      END;
      

      successfully creates the procedure, but it causes Debezium to fail with a parsing error.

      This patch fixes the problem for me (but I'm not sure if this is the right place to do the fix):

      diff --git a/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 b/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4
      index acb8ea09..3aaf1ab4 100644
      --- a/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4
      +++ b/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4
      @@ -2095,7 +2095,7 @@ collectionOption
       convertedDataType
           : typeName=(BINARY| NCHAR) lengthOneDimension?
           | typeName=CHAR lengthOneDimension? ((CHARACTER SET | CHARSET) charsetName)?
      -    | typeName=(DATE | DATETIME | TIME | JSON)
      +    | typeName=(DATE | DATETIME | TIME | JSON | INT | INTEGER)
           | typeName=DECIMAL lengthTwoDimension?
           | (SIGNED | UNSIGNED) INTEGER?
           ;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ateijelo Andy Teijelo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: