Support row alias on INSERT ... VALUES/SET (#22)#34
Merged
Conversation
MySQL 8.0.19 added a row alias on the inserted row (`INSERT ... VALUES (...) AS new ON DUPLICATE KEY UPDATE col = new.col`) to replace the deprecated `VALUES(col)` function inside the update list. Extend `InsertStmt` with `RowAlias` and `ColumnAliases`, and add the optional `AS row_alias [(col_alias_list)]` slot to the `VALUES` and `SET` forms of `InsertValues`. The `SELECT` form is intentionally left out: attaching the alias there propagates `AS` into the column-alias FOLLOW set inside `SELECT` and yields a shift/reduce conflict that goyacc rejects. REPLACE is left unchanged; it has no ON DUPLICATE KEY UPDATE, so a row alias is meaningless there.
The Makefile's genkeyword target produces a Go binary at parser/genkeyword that's used by `go generate`. It's a build output, not source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MySQL 8.0.19 added a row alias on the inserted row
(
INSERT ... VALUES (...) AS new ON DUPLICATE KEY UPDATE col = new.col)to replace the deprecated
VALUES(col)function inside the update list.Extend
InsertStmtwithRowAliasandColumnAliases, and add theoptional
AS row_alias [(col_alias_list)]slot to theVALUESandSETforms of
InsertValues. TheSELECTform is intentionally left out:attaching the alias there propagates
ASinto the column-alias FOLLOWset inside
SELECTand yields a shift/reduce conflict that goyaccrejects.
REPLACE is left unchanged; it has no ON DUPLICATE KEY UPDATE, so a row
alias is meaningless there.