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
{{ message }}
Repository navigation
Major Issue in 4.4, FROM Keyword is not Mandatory #1514
1. is this new feature in 4.4 ? if not , why it is working in 4.3 ?
Yes, prior 4.4 JSQLParser supported only SELECT SimpleExpression, which has been improved now into SELECT Expression.
2. Secondly , i tried with validation framework , but the validation errors is 0 , do i miss something below ?
Validation validation = new Validation(Arrays.asList(DatabaseType.ORACLE), "SELECT SYSDATE DUAL WHERE 1=1");
List<ValidationError> errors = validation.validate();
I can not say much about the Validation Framework, because I do not maintain or use it.
Although I do know that it has holes and did not fully keep up with the latest JSQLParser developments.
So if you want to use it, then rather understand it as a template, which you may want to add to in order to validate your particular concerns.
from below article , i can see some databases support "SELECT without FROM"
In that case , my suggestion will be adding database type during parse in CCJSqlParserUtil.parse(sqlStatement);
Your consideration is correct and in fact I have had similar thoughts in the past.
However:
a) JSQLParser's main objective is to parse RDBMS agnostic and to retrieve the AST from any SQL
b) We would have to maintain a Grammar for each dialect, while JavaCC does not support any include directive. So we would need to engage a template-engine for the Grammars -- a lot of work not justified by any added value
Your provided statement is parsed correctly.
You do not want to parse, but to validate. That's what the validation framework is for. If you find a short coming in the validation framework, then best thing was to submit a PR (because interest in that validation framework seems to be low).
thanks @manticore-projects , could you please update the release notes for 4.4, so that it will be clear ?.
i feel like the validation framework should be re-worked, just fixing a simple case wont work , thats how i feel , i may be wrong also.
i will add the validation from my side . please close the ticket , once the release notes is updated.
I check with version 4.0, 4.1, 4.3 and could successfully parse your statement SELECT SYSDATE DUAL. So what do you mean by ""FROM" keyword validation is working in 4.3"?
Activity
manticore-projects commentedon Apr 19, 2022
Greetings.
Your statement matches
SELECT expression aliasand is valid Standard SQL (although not Oracle compliant).If you want to validate against the Oracle Dialect, you may look onto the Validation Framework (part of JSQLParser).
bala28 commentedon Apr 19, 2022
thanks @manticore-projects for reply.
from below article , i can see some databases support "SELECT without FROM"
https://modern-sql.com/use-case/select-without-from ,
In that case , my suggestion will be adding database type during parse in
CCJSqlParserUtil.parse(sqlStatement);manticore-projects commentedon Apr 19, 2022
Yes, prior 4.4 JSQLParser supported only
SELECT SimpleExpression, which has been improved now intoSELECT Expression.I can not say much about the Validation Framework, because I do not maintain or use it.
Although I do know that it has holes and did not fully keep up with the latest JSQLParser developments.
So if you want to use it, then rather understand it as a template, which you may want to add to in order to validate your particular concerns.
Your consideration is correct and in fact I have had similar thoughts in the past.
However:
a) JSQLParser's main objective is to parse RDBMS agnostic and to retrieve the AST from any SQL
b) We would have to maintain a Grammar for each dialect, while JavaCC does not support any
includedirective. So we would need to engage a template-engine for the Grammars -- a lot of work not justified by any added valueYour provided statement is parsed correctly.
You do not want to parse, but to validate. That's what the validation framework is for. If you find a short coming in the validation framework, then best thing was to submit a PR (because interest in that validation framework seems to be low).
bala28 commentedon Apr 19, 2022
thanks @manticore-projects , could you please update the release notes for 4.4, so that it will be clear ?.
i feel like the validation framework should be re-worked, just fixing a simple case wont work , thats how i feel , i may be wrong also.
i will add the validation from my side . please close the ticket , once the release notes is updated.
wumpz commentedon Apr 26, 2022
I check with version 4.0, 4.1, 4.3 and could successfully parse your statement
SELECT SYSDATE DUAL. So what do you mean by ""FROM" keyword validation is working in 4.3"?