Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
niconoe- opened this issue Feb 1, 2023 · 1 comment · Fixed by #421
Closed

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

niconoe- opened this issue Feb 1, 2023 · 1 comment · Fixed by #421
Assignees
Labels
Milestone

Comments

@niconoe-
Copy link
Contributor

niconoe- commented Feb 1, 2023

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.

@iifawzi
Copy link
Contributor

iifawzi commented Feb 7, 2023

Hi,

Thank you for reporting this issue, and I think the solution you proposed would work as expected

@williamdes williamdes added the bug label Feb 8, 2023
@williamdes williamdes self-assigned this Feb 8, 2023
@williamdes williamdes added this to the 5.8.0 milestone Feb 8, 2023
williamdes added a commit that referenced this issue Feb 26, 2023
Pull-request: #421

Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants