[mysqldef] found syntax error when parsing trigger uses status column
#779
Replies: 3 comments
-
|
This happens because Note that I'll work on updating the parser to not treat |
Beta Was this translation helpful? Give feedback.
-
|
After checking various cases, I found that only This works: CREATE TABLE test_trigger (
id int(11) NOT NULL AUTO_INCREMENT,
`status` int(4),
`interval` int(4),
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TRIGGER `test_trigger_BEFORE_INSERT` before insert ON `test_trigger` FOR EACH ROW begin
set NEW.interval = 0;
end;This causes an error: CREATE TABLE test_trigger (
id int(11) NOT NULL AUTO_INCREMENT,
`status` int(4),
`interval` int(4),
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TRIGGER `test_trigger_BEFORE_INSERT` before insert ON `test_trigger` FOR EACH ROW begin
set NEW.status = 0;
end;
testutils.go:145: found syntax error when parsing DDL "CREATE TRIGGER `test_trigger_BEFORE_INSERT` before insert ON `test_trigger` FOR EACH ROW begin
set NEW.status = 0;
end": syntax error at position 110 near 'status'So it looks like we can fix this by modifying the behavior only for the |
Beta Was this translation helpful? Give feedback.
-
|
fixed by #784 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When creating a table with a column named status and a trigger that references this column, the parser throws a syntax error incorrectly identifying the column name as the source of the issue.
SQL
Error
Beta Was this translation helpful? Give feedback.
All reactions