File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/select Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -1116,11 +1116,13 @@ Import SubImport() #SubImport: {
11161116 List<ImportColumn> importColumns;
11171117 ImportFromItem fromItem;
11181118} {
1119- <K_IMPORT>
1120- [ <K_INTO> importColumns = ImportColumns() { impt.setImportColumns(importColumns); } ]
1119+ "("
1120+ <K_IMPORT>
1121+ [ <K_INTO> importColumns = ImportColumns() { impt.setImportColumns(importColumns); } ]
11211122
1122- <K_FROM>
1123- fromItem = ImportFromItem() { impt.setFromItem(fromItem); }
1123+ <K_FROM>
1124+ fromItem = ImportFromItem() { impt.setFromItem(fromItem); }
1125+ ")"
11241126
11251127 {
11261128 return impt;
@@ -3234,7 +3236,7 @@ PlainSelect PlainSelect() #PlainSelect:
32343236 selectItems=SelectItemsList()
32353237
32363238 [ LOOKAHEAD(2) intoTables = IntoClause() { plainSelect.setIntoTables(intoTables); } ]
3237- [ LOOKAHEAD(2) <K_FROM> ( fromItem=FromItem() | fromItem=SubImport() )
3239+ [ LOOKAHEAD(2) <K_FROM> fromItem=FromItem()
32383240 [ LOOKAHEAD(2) lateralViews=LateralViews() ]
32393241 [ LOOKAHEAD(2) joins=JoinsList() ]
32403242 ]
@@ -3818,6 +3820,8 @@ FromItem FromItem() #FromItem:
38183820 |
38193821 fromItem=LateralSubSelect()
38203822 |
3823+ LOOKAHEAD(2) fromItem=SubImport() { fromItem = new ParenthesedFromItem(fromItem); }
3824+ |
38213825 LOOKAHEAD({ getAsBoolean(Feature.allowUnparenthesizedSubSelects) }) fromItem=Select()
38223826 )
38233827
Original file line number Diff line number Diff line change @@ -6154,4 +6154,14 @@ public void testSelectWithSkylineKeywords() throws JSQLParserException {
61546154 select .getPlainSelect ().getSelectItems ().toString ());
61556155 }
61566156
6157+ @ ParameterizedTest
6158+ @ ValueSource (strings = {
6159+ "SELECT * FROM ( IMPORT FROM EXA AT connectionName STATEMENT 'select 1' )" ,
6160+ "SELECT * FROM ( IMPORT INTO ( LIKE schemaName.tableName ( a, b as c) ) FROM EXA AT connectionName STATEMENT 'select 1' )" ,
6161+ "SELECT * FROM schemaName.tableName JOIN ( IMPORT FROM EXA AT connectionName STATEMENT 'select 1' ) USING ( columnName )"
6162+ })
6163+ public void testSelectWithSubImport (String sqlStr ) throws JSQLParserException {
6164+ TestUtils .assertSqlCanBeParsedAndDeparsed (sqlStr );
6165+ }
6166+
61576167}
You can’t perform that action at this time.
0 commit comments