Repository navigation
fix: parse MySQL events as SHOW CREATE EVENT prints them - #2871
Merged
manticore-projects merged 1 commit intoOct 29, 2026
Merged
manticore-projects merged 1 commit into
manticore-projects merged 1 commit into
Conversation
SHOW CREATE EVENT prints DEFINER=user@host before EVENT, and MySQL 8.4 prints DISABLE ON REPLICA for an event that is disabled on replicas. Event bodies are often BEGIN ... END blocks. CREATE and ALTER EVENT with a DEFINER fell back to UnsupportedStatement, and DISABLE ON REPLICA and a BEGIN ... END body failed. CREATE EVENT and ALTER EVENT now read DEFINER with the production that stored routines use and keep it in EventStatement.getDefiner(). The body reuses MySqlTriggerBody, so a block of SQL statements is a Block and other compound statements keep their tokens, as in triggers. EventStatus gains DISABLE_ON_REPLICA; DISABLE ON SLAVE still gives DISABLE_ON_SLAVE. Signed-off-by: minleejae <mmj9808@gmail.com>
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SHOW CREATE EVENTprintsDEFINER=user@hostbeforeEVENT, printsDISABLE ON REPLICAfor an event that is disabled on replicas, and keeps aBEGIN … ENDbody as written. None of these parsed as an event.CREATE DEFINER=… EVENTandALTER DEFINER=… EVENTfell back toUnsupportedStatement, andDISABLE ON REPLICAand aBEGIN … ENDbody failed. Of sevenSHOW CREATE EVENToutputs from MySQL 8.4.11, five becameUnsupportedStatementand two failed.CREATE EVENTandALTER EVENTnow read the optionalDEFINERwith the production that stored routines use, and keep it as aMySqlDefinerinEventStatement.getDefiner(). The body reusesMySqlTriggerBody, so a block of SQL statements becomes aBlock, and other compound statements such asIF … END IFkeep their tokens, as in triggers.EventStatusgainsDISABLE_ON_REPLICA.DISABLE ON SLAVE, which MySQL 8.4 still accepts with a deprecation warning, givesDISABLE_ON_SLAVEas before.Public method signatures are retained. One existing test expected
CREATE DEFINER = x EVENT …to fall back toUnsupportedStatement(#2864); it now expects aCreateEvent.Syntax reference: MySQL 8.4 CREATE EVENT, ALTER EVENT, SHOW CREATE EVENT.
Validation:
EventStatementTestadds 9 statements. Each is parsed with and without the MySQL dialect, deparsed, and parsed again inside a script. Further tests check the definer, the block body and the replica status. On masterc84ad0ebc, 5 of the 9 fail and 3 becomeUnsupportedStatement; onlyDISABLE ON SLAVEparses as an event.SHOW CREATE EVENToutputs now parse asCreateEventand round-trip.check: 12,275 tests, 0 failures, 25 skipped. Grammar ambiguity, formatting (Spotless ratchet againstupstream/master), Checkstyle, PMD, SpotBugs and JaCoCo pass.CCJSqlParser(JaCoCo instrumentation of CCJSqlParser is approaching the constant-pool limit #2866): 808 entries on master, 720 with this change.AI assistance: prepared with Claude Code.