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

Multiple SETs not supported in trigger

XMLWordPrintable

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

      Originally reported - https://gitter.im/debezium/user?at=5ed4e8f52c49c45f5ab63974

      Offending DDL

              CREATE TRIGGER `rtl_trigger_before_update`
              BEFORE UPDATE
              ON all_student_educator FOR EACH ROW
              BEGIN
                  IF NEW.student_words_read_total is not null AND NEW.student_words_read_total >= {count} AND NEW.badge_{count}_words_read_flag = 0 THEN
                      SET 
                      NEW.badge_flag = 1,
                      NEW.badge_student_total = NEW.badge_student_total + 1,
                      NEW.badge_datetime = now();
                      INSERT IGNORE INTO user_platform_badge (platform_badge_id, user_id) VALUES ({badge_id}, NEW.student_id);
                  END IF;
              END
      

      Exception thrown

      "trace": "org.apache.kafka.connect.errors.ConnectException: no viable alternative at input 'CREATE DEFINER=`ms`@`%` TRIGGER `rtl_trigger_before_insert`\\n        BEFORE INSERT\\n        ON all_student_educator FOR EACH ROW\\n        BEGIN\\n            IF NEW.student_words_read_total is not null AND NEW.student_words_read_total >= 5000 AND NEW.badge_5000_words_read_flag = 0 THEN\\n                SET \\n                NEW.badge_5000_words_read_flag = 1,'\n\tat io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)\n\tat io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:207)\n\tat io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:536)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1095)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:943)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:580)\n\tat com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:825)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: io.debezium.text.ParsingException: no viable alternative at input 'CREATE DEFINER=`ms`@`%` TRIGGER `rtl_5000_words_read_badge_trigger_before_insert`\\n        BEFORE INSERT\\n        ON all_student_educator FOR EACH ROW\\n        BEGIN\\n            IF NEW.student_words_read_total is not null AND NEW.student_words_read_total >= 5000 AND NEW.badge_5000_words_read_flag = 0 THEN\\n                SET \\n                NEW.badge_5000_words_read_flag = 1,'\n\tat io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40)\n\tat org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)\n\tat org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)\n\tat org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)\n\tat org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)\n\tat io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1121)\n\tat io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:849)\n\tat io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68)\n\tat io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41)\n\tat io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80)\n\tat io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:308)\n\tat io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:729)\n\tat io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:519)\n\t... 5 more\nCaused by: org.antlr.v4.runtime.NoViableAltException\n\tat org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)\n\tat org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)\n\tat org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)\n\tat io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:923)\n\t... 12 more\n"
      

              jpechane Jiri Pechanec
              jpechane Jiri Pechanec
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: