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

[MySQL] Positive-Technologhy parser cannot handle row alias after SET in INSERT statement #4373

Open
OnMYLai opened this issue Jan 2, 2025 · 0 comments

Comments

@OnMYLai
Copy link

OnMYLai commented Jan 2, 2025

According to MySQL 8.0 doc:

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
SET assignment_list
[AS row_alias[(col_alias [, col_alias] ...)]]
[ON DUPLICATE KEY UPDATE assignment_list]

It is possible to set row alias after SET, however in Positive-Technology parser insertStatement rule:

insertStatement
    : INSERT priority = (LOW_PRIORITY | DELAYED | HIGH_PRIORITY)? IGNORE? INTO? tableName (
        PARTITION '(' partitions = uidList? ')'
    )? (
        ('(' columns = fullColumnNameList? ')')? insertStatementValue (AS? uid)?
        | SET setFirst = updatedElement (',' setElements += updatedElement)*
    ) (
        ON DUPLICATE KEY UPDATE duplicatedFirst = updatedElement (
            ',' duplicatedElements += updatedElement
        )*
    )?
    ;

The (AS? uid)? is not preset in the SET case. On top of that, the single uid would not be able to deal with column aliases after row alias.

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

No branches or pull requests

1 participant