GeezerVison is showing github.com — [BUG] JSQLParser Version : 5.1 RDBMS : MySql can't parse simple update sql · Issue #2136 · JSQLParser/JSqlParser
[BUG] JSQLParser Version : 5.1 RDBMS : MySql can't parse simple update sql #2136DescriptionAlways check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram
Failing SQL Feature:
- Brief description of the failing SQL feature
can't parse sql update QUOTE set GROUP_ID=11077, SYMBOL_ID=18099, SOURCE_ID=4911626959315300, PRODUCT_ID=305846785, COMPANY_ID=21, LOW=3671269332022271850, HIGH=2113385670496105969, OPEN=1043534829692535483, SCALE=106, STATUS=0, LADDERED=1 where ID=2384974680491559964
Reproduce code
public static void main(String[] args) {
String sql = "update QUOTE set GROUP_ID=11077, SYMBOL_ID=18099, SOURCE_ID=4911626959315300, PRODUCT_ID=305846785, COMPANY_ID=21, LOW=3671269332022271850, HIGH=2113385670496105969, OPEN=1043534829692535483, SCALE=106, STATUS=0, LADDERED=1 where ID=2384974680491559964";
try {
CCJSqlParserUtil.parseStatements(sql);
} catch (JSQLParserException e) {
e.printStackTrace();
}
}
Exception stack
net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 114.
Was expecting one of:
"FROM"
"LIMIT"
"ORDER"
"OUTPUT"
"PREFERRING"
"RETURN"
"RETURNING"
"WHERE"
<EOF>
<ST_SEMICOLON>
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:444)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:414)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:377)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:367)
at cn.nextop.erebor.core.common.storage.support.XPreparedStatementHandler.main(XPreparedStatementHandler.java:76)
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 114.
Was expecting one of:
"FROM"
"LIMIT"
"ORDER"
"OUTPUT"
"PREFERRING"
"RETURN"
"RETURNING"
"WHERE"
<EOF>
<ST_SEMICOLON>
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:437)
... 4 more
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 114.
Was expecting one of:
"FROM"
"LIMIT"
"ORDER"
"OUTPUT"
"PREFERRING"
"RETURN"
"RETURNING"
"WHERE"
<EOF>
<ST_SEMICOLON>
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:48520)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:48341)
at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:1071)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$2.call(CCJSqlParserUtil.java:433)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$2.call(CCJSqlParserUtil.java:430)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Software Information:
- JSqlParser version : 5.1
- Database MySql
Tips:
Please write in English and avoid Screenshots (as we can't copy and paste content from it).
Try your example online with the latest JSQLParser and share the link in the error report.
Do provide Links or References to the specific Grammar and Syntax you are trying to use. Activitynicky6s commented on Jan 5, 2025 I think this is a result of this PR, where the word "LOW" was added as a restricted keyword to support Skyline syntax -> #2078 nicky6s commented on Jan 5, 2025 The "HIGH" restricted keyword was also added in the same PR, so this will also be impacting the parsing of the same UPDATE statement nicky6s commented on Jan 5, 2025 Adding "s around the LOW and HIGH columns seems to help, the statement below parses successfully as far as I can see...
update QUOTE
set
GROUP_ID = 11077,
SYMBOL_ID = 18099,
SOURCE_ID = 4911626959315300,
PRODUCT_ID = 305846785,
COMPANY_ID = 21,
"LOW" = 3671269332022271850,
"HIGH" = 2113385670496105969,
OPEN = 1043534829692535483,
SCALE = 106,
STATUS = 0,
LADDERED = 1
where
ID = 2384974680491559964
nicky6s commented on Jan 5, 2025 In version 5.1
These statements do not parse...
UPDATE mytable SET low = 1, high = 2 WHERE id = 3;
DELETE FROM mytable WHERE low = 1 AND high = 2;
SELECT low, high FROM mytable;
These statements successfully parse...
UPDATE mytable SET "low" = 1, "high" = 2 WHERE id = 3;
DELETE FROM mytable WHERE "low" = 1 AND "high" = 2;
SELECT "low", "high" FROM mytable;
nicky6s commented on Jan 5, 2025 Same thing for the "INVERSE", "PLUS" and "PREFERRING" restricted keywords also added in the same PR nicky6s commented on Jan 5, 2025 Ive created this PR which I think might fix the issue -> #2137 nicky6s commented on Jan 5, 2025 Added this discussion -> #2138 nicky6s commented on Jan 7, 2025 manticore-projects commented on Jan 14, 2025 I think this has been resolved.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|