Skip to content

fix(mysql): support IF EXISTS/IF NOT EXISTS in trigger/revoke syntax#60

Merged
rebelice merged 4 commits intomainfrom
codex/parser-patch
Feb 27, 2026
Merged

fix(mysql): support IF EXISTS/IF NOT EXISTS in trigger/revoke syntax#60
rebelice merged 4 commits intomainfrom
codex/parser-patch

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Feb 27, 2026

Summary

  • add MySQL parser support for CREATE TRIGGER IF NOT EXISTS
  • add MySQL parser support for REVOKE IF EXISTS ...
  • add MySQL parser support for trailing IGNORE UNKNOWN USER in REVOKE
  • add parser regression examples for these statements

Testing

  • go test ./mysql -run 'TestMySQLDBSQLParser/examples/(create_trigger_if_not_exists|revoke_if_exists_select|revoke_if_exists_ignore_unknown_user)\.sql$' -count=1
  • go test ./mysql -count=1

Copilot AI review requested due to automatic review settings February 27, 2026 10:03
@rebelice rebelice enabled auto-merge (squash) February 27, 2026 10:08
@rebelice rebelice merged commit f75e297 into main Feb 27, 2026
5 checks passed
@rebelice rebelice deleted the codex/parser-patch branch February 27, 2026 10:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the MySQL parser to support additional conditional and error-handling syntax in DDL statements, specifically adding support for IF EXISTS and IF NOT EXISTS clauses in REVOKE and CREATE TRIGGER statements, as well as the IGNORE UNKNOWN USER clause in REVOKE statements.

Changes:

  • Added IF EXISTS support to REVOKE statements
  • Added IF NOT EXISTS support to CREATE TRIGGER statements
  • Added IGNORE UNKNOWN USER trailing clause support to REVOKE statements

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mysql/MySQLParser.g4 Updated grammar rules to add optional ifNotExists to createTrigger, optional ifExists and ignoreUnknownUser to revoke, and defined new ignoreUnknownUser rule
mysql/mysqlparser_visitor.go Added VisitIgnoreUnknownUser method to visitor interface (auto-generated)
mysql/mysqlparser_listener.go Added EnterIgnoreUnknownUser and ExitIgnoreUnknownUser methods to listener interface (auto-generated)
mysql/mysqlparser_base_visitor.go Implemented VisitIgnoreUnknownUser method in base visitor (auto-generated)
mysql/mysqlparser_base_listener.go Implemented EnterIgnoreUnknownUser and ExitIgnoreUnknownUser methods in base listener (auto-generated)
mysql/examples/revoke_if_exists_select.sql Added test example for REVOKE IF EXISTS syntax
mysql/examples/revoke_if_exists_ignore_unknown_user.sql Added test example for REVOKE IF EXISTS with IGNORE UNKNOWN USER
mysql/examples/create_trigger_if_not_exists.sql Added test example for CREATE TRIGGER IF NOT EXISTS syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

3 participants