Skip to content

SET clause with alias not parsed #1314

Description

@rptr

Describe the bug

I found this query in the MySQL 8.0 Reference Manual page 2678

To Reproduce
1. INSERT INTO t1 SET a=1,b=2,c=3 AS new(m,n,p) ON DUPLICATE KEY UPDATE c = m+n;
2. CCJSqlParserUtil.parse(query)
3. Exception:

net.sf.jsqlparser.JSQLParserException
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:65)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:40)
	Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "AS" "AS"
    at line 1, column 32.
    Was expecting one of:
    "&"
    ","
    "::"
    ";"
    "<<"
    ">>"
    "COLLATE"
    "ON"
    "RETURNING"
    "["
    "^"
    "|"
    <EOF>

Expected behavior
I expected example queries from the MySQL manual to be parsed correctly.

System

  • MySQL
  • Java 8 (OpenJDK)
  • JSqlParser 4.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions