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: {
1116
1116
List<ImportColumn> importColumns;
1117
1117
ImportFromItem fromItem;
1118
1118
} {
1119
- <K_IMPORT>
1120
- [ <K_INTO> importColumns = ImportColumns() { impt.setImportColumns(importColumns); } ]
1119
+ "("
1120
+ <K_IMPORT>
1121
+ [ <K_INTO> importColumns = ImportColumns() { impt.setImportColumns(importColumns); } ]
1121
1122
1122
- <K_FROM>
1123
- fromItem = ImportFromItem() { impt.setFromItem(fromItem); }
1123
+ <K_FROM>
1124
+ fromItem = ImportFromItem() { impt.setFromItem(fromItem); }
1125
+ ")"
1124
1126
1125
1127
{
1126
1128
return impt;
@@ -3234,7 +3236,7 @@ PlainSelect PlainSelect() #PlainSelect:
3234
3236
selectItems=SelectItemsList()
3235
3237
3236
3238
[ LOOKAHEAD(2) intoTables = IntoClause() { plainSelect.setIntoTables(intoTables); } ]
3237
- [ LOOKAHEAD(2) <K_FROM> ( fromItem=FromItem() | fromItem=SubImport() )
3239
+ [ LOOKAHEAD(2) <K_FROM> fromItem=FromItem()
3238
3240
[ LOOKAHEAD(2) lateralViews=LateralViews() ]
3239
3241
[ LOOKAHEAD(2) joins=JoinsList() ]
3240
3242
]
@@ -3818,6 +3820,8 @@ FromItem FromItem() #FromItem:
3818
3820
|
3819
3821
fromItem=LateralSubSelect()
3820
3822
|
3823
+ LOOKAHEAD(2) fromItem=SubImport() { fromItem = new ParenthesedFromItem(fromItem); }
3824
+ |
3821
3825
LOOKAHEAD({ getAsBoolean(Feature.allowUnparenthesizedSubSelects) }) fromItem=Select()
3822
3826
)
3823
3827
Original file line number Diff line number Diff line change @@ -6154,4 +6154,14 @@ public void testSelectWithSkylineKeywords() throws JSQLParserException {
6154
6154
select .getPlainSelect ().getSelectItems ().toString ());
6155
6155
}
6156
6156
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
+
6157
6167
}
You can’t perform that action at this time.
0 commit comments