Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL can't parse Triggers when comparing schemas #170

Closed
andrewmcfaul opened this issue Nov 4, 2021 · 2 comments
Closed

MySQL can't parse Triggers when comparing schemas #170

andrewmcfaul opened this issue Nov 4, 2021 · 2 comments

Comments

@andrewmcfaul
Copy link

andrewmcfaul commented Nov 4, 2021

When comparing two schemas that contain a trigger definition, the comparison fails with an error.

Input SQL

CREATE TABLE `test_trigger` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TRIGGER BEFORE_UPDATE_test_trigger
BEFORE INSERT
ON test_trigger FOR EACH ROW BEGIN
SET NEW.`id` = NEW.`id` + 10;
END;

Current output

found syntax error when parsing DDL "CREATE TRIGGER BEFORE_UPDATE_test_trigger
BEFORE INSERT
ON test_trigger FOR EACH ROW BEGIN
SET NEW.id = NEW.id + 10": syntax error at position 91 near 'begin'

Expected output

It should parse the trigger definitions

@k0kubun
Copy link
Collaborator

k0kubun commented Nov 4, 2021

By the way, could you please wrap your code with code blocks with ``` next time? It's harder to read than:

CREATE TABLE `test_trigger` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TRIGGER BEFORE_UPDATE_test_trigger
BEFORE INSERT
ON test_trigger FOR EACH ROW BEGIN
SET NEW.`id` = NEW.`id` + 10;
END;

@k0kubun k0kubun closed this as completed in 26603cb Nov 5, 2021
@k0kubun
Copy link
Collaborator

k0kubun commented Nov 5, 2021

I made the test case parsable in v0.11.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants