Skip to content

[BUG] 4.7: MySQL : Alter Add Key Encountered unexpected token: "comment" "COMMENT" #1906

Closed

Description

@linux2014linux

Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram

Failing SQL Feature:

  net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "comment" "COMMENT"
    at line 1, column 51.

Was expecting one of:

    ","
    "DEFERRABLE"
    "DISABLE"
    "ENABLE"
    "NOT"
    "NOVALIDATE"
    "USING"
    "VALIDATE"
    <EOF>
    <ST_SEMICOLON>


	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:315)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:116)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:85)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:62)

SQL Example:

    alter table `student` add key `idx_name` (`name`) comment 'index name';

Software Information:

  • JSqlParser version 4.7
  • MySQL

Activity

  1. added 2 commits that reference this issue on Dec 15, 2023
    084354f
    af73c84
  2. added a commit that references this issue on Dec 15, 2023
    262ef55
  3. linux2014linux commented on Dec 19, 2023

    @linux2014linux
    Author

    @manticore-projects @jxnu-liguobin Release 4.7 still don't parse sql:

        alter table `student` add key `idx_name` (`name`) comment 'index name';
    
  4. manticore-projects commented on Dec 19, 2023

    @manticore-projects
    Contributor

    The changes and improvements are in JSQLParser 4.8 SNAPSHOT only and I would like to advise to use the snapshot version.

  5. linux2014linux commented on Dec 19, 2023

    @linux2014linux
    Author

    The changes and improvements are in JSQLParser 4.8 SNAPSHOT only and I would like to advise to use the snapshot version.

    Ok, I should use it which mvn version.

  6. manticore-projects commented on Dec 19, 2023

    @manticore-projects
    Contributor

    Ok, I should use it which mvn version.

    Unfortunately there is still no Maven Snapshot published (since @wumpz has time constraints).
    But you can download the SNAPSHOT JAR file from here: https://manticore-projects.com/JSQLParser/index.html

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions