Skip to content

Exception parsing show statement #1702

Description

@jayant-kumar-yadav

I am trying to parse "show indexes from my_table" and it is throwing ParseException :

net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "from" "FROM"
at line 1, column 14.

Was expecting one of:

";"
<EOF>

at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:31234)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:31067)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:163)

Activity

  1. manticore-projects commented on Dec 26, 2022

    @manticore-projects
    Contributor

    Greetings.

    Your syntax show indexes from my_table is not supported, since it does not apply to any SQL Standard or major RDBMS (as far as I know).

    Supported syntax are shown here.

    You may want to provide or sponsor an implementation of this unsupported feature.

    Please don't cross-post though.

  2. jayant-kumar-yadav commented on Dec 26, 2022

    @jayant-kumar-yadav
    ContributorAuthor

    MySql family DBs support this so I thought it would be there.

  3. manticore-projects commented on Dec 26, 2022

    @manticore-projects
    Contributor

    Let me put it like this: We are mostly interested in parsing and understanding the actual logic of a SQL statement in order to find out about tables, columns, expressions, joins, where clauses etc.

    Your statement does not yield any of such information (except maybe the table name). It is RDBMS specific syntax for analysis.

    For that reason, it is not implemented yet. Nobody has had an interest so far, because its easier to just skip it.

    However, you can provide a PR when this statement is important for you.

  4. jayant-kumar-yadav commented on Dec 28, 2022

    @jayant-kumar-yadav
    ContributorAuthor

    Added PR #1704

  5. added a commit that references this issue on May 16, 2023
    daa56ed
  6. manticore-projects commented on May 16, 2023

    @manticore-projects
    Contributor

    Solved via commit daa56ed with PR #1778

    It does not make sense to implement all the various RDBMS specific syntax since the SHOW statement does not bear any value or interesting content. Although throwing exceptions is also annoying, so UnsupportedStatement is the way to go.

    If you are really interested in the content of the UnsupportedStatement then please use Regular Expressions on it.

  7. manticore-projects commented on May 16, 2023

    @manticore-projects
    Contributor

    Solved with PR #1704 and PR #1778

  8. added a commit that references this issue on Jun 1, 2023
    41b6fce
  9. added a commit that references this issue on Jun 15, 2023
    a815f5f
  10. added a commit that references this issue on Jun 27, 2023
    c79dfff
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