-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Closed
Copy link
Labels
Description
Failing SQL Feature:
This SQL parses fine for me in versions 5.1 + 5.2, but not in 5.3
INSERT INTO foo(col1, col2, col3, col4, col5, col6)
VALUES ((SELECT blah FROM bar INNER JOIN bam ON bar.col1 = bam.col1 WHERE bar.id = ? AND et.id = ?), ?, ?, ?, ?, ?)
ON CONFLICT (id) DO UPDATE
SET col4 = ?, col5 = ?, col6 = ?
Versions 5.1 & 5.2
5.3
Exception
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 2, column 102.
Was expecting one of:
")"
Context
We are using JSQlParser version 5.2 and are looking at bumping to use 5.3, but we have discovered SQL statements now not parsing
Test Code
@Test
void blahblah() throws JSQLParserException {
String sqlStr = """
INSERT INTO foo(col1, col2, col3, col4, col5, col6)
VALUES ((SELECT blah FROM bar INNER JOIN bam ON bar.col1 = bam.col1 WHERE bar.id = ? AND et.id = ?), ?, ?, ?, ?, ?)
ON CONFLICT (id) DO UPDATE
SET col4 = ?, col5 = ?, col6 = ?
""";
Statement statement = CCJSqlParserUtil.parse(sqlStr);
System.out.println(statement.toString());
Insert insert = (Insert) statement;
assertThat(insert.getTable().toString()).isEqualTo("foo");
}