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

MySQL "national" keyword is not accepted as column name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3.0.CR1
    • 2.1.4.Final, 2.2.1.Final
    • mysql-connector
    • None
    • False
    • None
    • False
    • Moderate

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

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      debezium-connector-mysql 2.1.4.Final

      What is the connector configuration?

      Irrelevant

      What is the captured database version and mode of depoyment?

      Google CloudSQL

      What behaviour do you expect?

      Debezium parses SQL

      What behaviour do you see?

      org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.
      	at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:53)
      	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleEvent(MySqlStreamingChangeEventSource.java:392)
      	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$execute$27(MySqlStreamingChangeEventSource.java:922)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1246)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:1072)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:631)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:932)
      	at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: io.debezium.DebeziumException: Error processing binlog event
      	... 7 more
      Caused by: io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE TABLE paymentleobanking.payment_scheme (id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NULL, short_code VARCHAR(255) NULL, priority INT NULL, national BIT(1) NULL, country_uid VARCHAR(2) NULL, CONSTRAINT PK_PAYMENT_SCHEME PRIMARY KEY (id))'
      no viable alternative at input 'CREATE TABLE paymentleobanking.payment_scheme (id BIGINT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NULL, short_code VARCHAR(255) NULL, priority INT NULL, national BIT'
      	at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:43)
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1250)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:972)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:74)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:46)
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:78)
      	at io.debezium.connector.mysql.MySqlDatabaseSchema.parseDdl(MySqlDatabaseSchema.java:213)
      	at io.debezium.connector.mysql.MySqlDatabaseSchema.parseStreamingDdl(MySqlDatabaseSchema.java:199)
      	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleQueryEvent(MySqlStreamingChangeEventSource.java:590)
      	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$execute$15(MySqlStreamingChangeEventSource.java:893)
      	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleEvent(MySqlStreamingChangeEventSource.java:372)
      	... 6 more
      Caused by: org.antlr.v4.runtime.NoViableAltException
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1048)
      	... 15 more
      

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

      (Ideally, also verify with latest Alpha/Beta/CR version)

      Yes, i tried adding the following statement to debezium-ddl-parser/src/test/resources/mysql/examples/ddl_create.sql in master branch;

      CREATE TABLE foo.bar (national BIT(1) NULL)
      

      Which made the build fail.

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

      See above.

      How to reproduce the issue using our tutorial deployment?

      Not needed, it is easily reproducible in maven build/test.

      Implementation ideas (optional)

      I tried adding NATIONAL to keywordsCanBeId in debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 which made the DDL parseable.

              Unassigned Unassigned
              tommy.karlsson Tommy Karlsson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: