Skip to content

ALTER EVENT statement with DEFINER=user modifier fails to be parsed #418

Closed
@niconoe-

Description

@niconoe-

Looking at the MySQL Documentation, it is possible to run such query:

ALTER DEFINER = user EVENT myEvent ENABLE;

Nevertheless, when you try to execute it on the linter, it fails to be parsed:1

> php bin/lint-query --query "ALTER DEFINER = user EVENT myEvent ENABLE;"
#1: Missing comma before the beginning of a new operation ALTER. (near "ENABLE" at position 37)
#2: Operation ALTER not recognized. (near "ENABLE" at position 37)

My suggestion would be to add the following element into AlterStatement::$OPTIONS:

        // `DEFINER` is also used for `ALTER EVENT`
        'DEFINER' => [
            2,
            'expr=',
        ],

But I don't know the impact yet.

As far as I know, support for the DEFINER clause was added in MySQL 5.1.17 (Section 13.1.2), so I don't know how to handle this correctly regarding the fact the sql-parser should stay compatible with MySQL 5.0.

Anyway, I'll try to provide a PR soon about it.

Footnotes

  1. messages are translated from French to English manually.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions