JSqlParser
JSqlParser copied to clipboard
WithIsolation regression between v4.3 and v4.4
Hi, I found that following query cannot be parsed with v4.4, but with v4.3 it is ok.
@Test
void name1() throws JSQLParserException {
final String statement = "" +
"SELECT rresult.RR_DS_GUID,\n" +
" rresult.RR_OGUID AS r_oguid,\n" +
" rs.RSR_ACTIVE as barActive\n" +
"FROM foo.AA_XXX_RRESULT rresult\n" +
"WHERE rresult.RR_DS_GUID = ?\n" +
" and r.RR_DELETED = 0" +
"";
assertSqlCanBeParsedAndDeparsed(statement, true,
parser -> parser.withSquareBracketQuotation(true));
}
When I change rs alias to something else, it is parsed correctly. I found that it is because of WithIsolation() parsing and token. When I remove it in v4.4, it is parsed correctly.
See
- https://github.com/JSQLParser/JSqlParser/blob/jsqlparser-4.4/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt#L215
- Regression commit https://github.com/JSQLParser/JSqlParser/commit/3e976528094e6462a80ac40aeb946bafa0c407bc
Mind that my SQL is isolated test case, and is part of much bigger SQL, and I am able to run it by MSSQL without error.
I am currently trying to create PR, but JavaCC is new to me (I am used to work with ANTLR).
What do you think?
Thx
Ivos
cc @chiangcho
I will fix it today
@Wumpz: looks to me like this was a perfect illustration, why the proposed Keywords-Improvement is needed.
The Update Keywords mechanism would have avoided both the Issue Report and also the PR addressing it. And the parametrized test would have revealed the problem during the WithIsolation PR cycle.
Closed, since no further question has been asked.