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

JSON functions in MySQL grammar unsupported

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      Execute the DDL in MySQL with a running connector

      CREATE TABLE campaign (CREATE TABLE campaign ( campaign_id varchar(32) NOT NULL, spec json NOT NULL);

      CREATE TRIGGER ins_campaign BEFORE INSERT ON campaign
      FOR EACH ROW SET NEW.campaign_id = NEW.spec->>'$.campaign_id';

      Show
      Execute the DDL in MySQL with a running connector CREATE TABLE campaign (CREATE TABLE campaign ( campaign_id varchar(32) NOT NULL, spec json NOT NULL); CREATE TRIGGER ins_campaign BEFORE INSERT ON campaign FOR EACH ROW SET NEW.campaign_id = NEW.spec->>'$.campaign_id';

      Description

      Debezium-connect 1.2.2.Final

      MySQL 8.0.21

       

      MySQL Connector error/stack trace:

      org.apache.kafka.connect.errors.ConnectException: no viable alternative at input 'CREATE DEFINER=`datoslab`@`%` TRIGGER ins_campaign BEFORE INSERT ON campaign\r\nFOR EACH ROW SET NEW.campaign_id = NEW.data->'
       at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)
       at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:207)
       at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:600)
       at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1130)
       at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:978)
       at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:581)
       at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:860)
       at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: io.debezium.text.ParsingException: no viable alternative at input 'CREATE DEFINER=`datoslab`@`%` TRIGGER ins_campaign BEFORE INSERT ON campaign\r\nFOR EACH ROW SET NEW.campaign_id = NEW.data->'
       at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40)
       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:1122)
       at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:850)
       at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68)
       at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41)
       at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80)
       at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:314)
       at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:793)
       at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:583)
       ... 5 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:924)
       ... 12 more
      

        Attachments

          Activity

            People

            Assignee:
            jpechanec Jiri Pechanec
            Reporter:
            datoslabs Eric Shieh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: