Skip to content

Fix UNIQUE index IF NOT EXISTS grammar ordering for MariaDB#2249

Open
TomasMerta wants to merge 1 commit into
zendesk:masterfrom
TomasMerta:TomasMerta/fix-unique-index-if-not-exists-grammar
Open

Fix UNIQUE index IF NOT EXISTS grammar ordering for MariaDB#2249
TomasMerta wants to merge 1 commit into
zendesk:masterfrom
TomasMerta:TomasMerta/fix-unique-index-if-not-exists-grammar

Conversation

@TomasMerta

Copy link
Copy Markdown

Reorder tokens in index_type_3 so KEY/INDEX comes before IF NOT EXISTS, matching MariaDB's official syntax:

  UNIQUE [INDEX|KEY] [IF NOT EXISTS] [index_name] ...

https://mariadb.com/kb/en/alter-table/

Previously Maxwell logged:

  ERROR MysqlParserListener - (index_type_3 UNIQUE (index_or_key KEY) IF NOT EXISTS

Add integration test guarded to MariaDB only.

Fixes #2204

Reorder tokens in index_type_3 so KEY/INDEX comes before IF NOT EXISTS,
matching MariaDB's official syntax:

  UNIQUE [INDEX|KEY] [IF NOT EXISTS] [index_name] ...
  https://mariadb.com/kb/en/alter-table/

Previously Maxwell logged:

  ERROR MysqlParserListener - (index_type_3 UNIQUE (index_or_key KEY) IF NOT EXISTS

Add integration test guarded to MariaDB only, with sensible
table/column/index names.

Fixes zendesk#2204
@TomasMerta TomasMerta requested a review from osheroff as a code owner April 23, 2026 07:18
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.

ADD UNIQUE KEY IF NOT EXISTS

1 participant