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

MySQL DDL parser - issue with triggers and NEW

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 0.10.0.Beta2
    • 0.9.4.Final
    • mysql-connector
    • None

      Debezium MySQL connector hangs after receiving binlog entry being result of execution of the following statement:

      CREATE TRIGGER mask_private_data
      BEFORE INSERT ON users 
      FOR EACH ROW BEGIN 
        SET NEW.phone = CONCAT('555', NEW.id);
      END;
      

      The error comes from antlr: no viable alternative at input
      I did some investigation and it looks the `SET NEW.sth = expression` is causing the issue, but it shouldn't since this is valid statement according to the official documentation:
      https://dev.mysql.com/doc/refman/8.0/en/trigger-syntax.html, see:

      You can refer to a column named with NEW if you have the SELECT privilege for it. In a BEFORE trigger, you can also change its value with SET NEW.col_name = value if you have the UPDATE privilege for it. This means you can use a trigger to modify the values to be inserted into a new row or used to update a row.

      I have a patch ready and I will push it to github right away.

            Unassigned Unassigned
            szczeles Mariusz Strzelecki (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: