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
et.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "conflict" <S_IDENTIFIER>
at line 3, column 12.
Was expecting:
"DUPLICATE"
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.Insert(CCJSqlParser.java:2991)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:236)
at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:706)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:213)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:203)
at com.baomidou.mybatisplus.extension.parser.JsqlParserSupport.parserMulti(JsqlParserSupport.java:63)
This fix is not working if we have 2 columns in on conflict clause.
Ex: insert into table ( col1, col2, updationtime, username, lastname ) values ( ?, ?, ?, ?, ? ) ON CONFLICT ( col1, col2 ) DO UPDATE SET username=EXCLUDED.username RETURNING id
It throws below error:
`could not parse query 'insert into userinfo ( col1, col2, updationtime, username, lastname ) values ( ?, ?, ?, ?, ? ) ON CONFLICT ( col1, col2 ) DO UPDATE SET username=EXCLUDED.username RETURNING id'
net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
")"
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:263)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:81)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:47)
at com.securonix.soar.database.cache.JDBCCache.getTableSet(JDBCCache.java:155)
at com.securonix.soar.database.cache.JDBCCache.main(JDBCCache.java:198)
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
")"
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.parseStatement(CCJSqlParserUtil.java:258)
... 4 common frames omitted
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
")"
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:33398)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:33231)
at net.sf.jsqlparser.parser.CCJSqlParser.InsertConflictTarget(CCJSqlParser.java:3017)
at net.sf.jsqlparser.parser.CCJSqlParser.Insert(CCJSqlParser.java:2967)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:252)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:157)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:253)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:250)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Activity
mrtang123 commentedon Jun 2, 2022
sql: insert into (xxx) values (xxx) on conflict(xxx) do update xxx ...
jsqlparser version is 4.3
Support Postgres INSERT ... ON CONFLICT
PostgreSQL INSERT ... ON CONFLICT Issue #1551 (#1552)
ashishkrgupta commentedon Feb 13, 2023
This fix is not working if we have 2 columns in on conflict clause.
Ex:
insert into table ( col1, col2, updationtime, username, lastname ) values ( ?, ?, ?, ?, ? ) ON CONFLICT ( col1, col2 ) DO UPDATE SET username=EXCLUDED.username RETURNING idIt throws below error:
`could not parse query 'insert into userinfo ( col1, col2, updationtime, username, lastname ) values ( ?, ?, ?, ?, ? ) ON CONFLICT ( col1, col2 ) DO UPDATE SET username=EXCLUDED.username RETURNING id'
net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 1, column 116.
Was expecting:
[]
`