You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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.
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.
Activity
manticore-projects commentedon Dec 26, 2022
Greetings.
Your syntax
show indexes from my_tableis 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.
jayant-kumar-yadav commentedon Dec 26, 2022
MySql family DBs support this so I thought it would be there.
manticore-projects commentedon Dec 26, 2022
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.
jayant-kumar-yadav commentedon Dec 28, 2022
Added PR #1704
refactor: SHOW statement, supporting any RDBMS specific implementation
manticore-projects commentedon May 16, 2023
Solved via commit daa56ed with PR #1778
It does not make sense to implement all the various RDBMS specific syntax since the
SHOWstatement does not bear any value or interesting content. Although throwing exceptions is also annoying, soUnsupportedStatementis the way to go.If you are really interested in the content of the
UnsupportedStatementthen please use Regular Expressions on it.manticore-projects commentedon May 16, 2023
Solved with PR #1704 and PR #1778
JSQLParser 5.0 (#1778)
Assorted Fixes #8 (#1807)
Backslash Quotation of Single-Quote `'\\''` (#1813)