File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
main/java/net/sf/jsqlparser/util
test/java/net/sf/jsqlparser/util Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1151,8 +1151,11 @@ public void visit(CreateTable createTable) {
1151
1151
}
1152
1152
1153
1153
@ Override
1154
- public <S > Void visit (CreateView createView , S context ) {
1155
- throwUnsupported (createView );
1154
+ public <S > Void visit (CreateView create , S context ) {
1155
+ visit (create .getView (), null );
1156
+ if (create .getSelect () != null ) {
1157
+ create .getSelect ().accept ((SelectVisitor <?>) this , context );
1158
+ }
1156
1159
return null ;
1157
1160
}
1158
1161
Original file line number Diff line number Diff line change @@ -152,12 +152,19 @@ public void testInsertSelect() throws Exception {
152
152
}
153
153
154
154
@ Test
155
- public void testCreateSelect () throws Exception {
155
+ public void testCreateTableSelect () throws Exception {
156
156
String sqlStr = "CREATE TABLE mytable AS SELECT mycolumn FROM mytable2" ;
157
157
assertThat (TablesNamesFinder .findTables (sqlStr )).containsExactlyInAnyOrder ("mytable" ,
158
158
"mytable2" );
159
159
}
160
160
161
+ @ Test
162
+ public void testCreateViewSelect () throws Exception {
163
+ String sqlStr = "CREATE VIEW mytable AS SELECT mycolumn FROM mytable2" ;
164
+ assertThat (TablesNamesFinder .findTables (sqlStr )).containsExactlyInAnyOrder ("mytable" ,
165
+ "mytable2" );
166
+ }
167
+
161
168
@ Test
162
169
public void testInsertSubSelect () throws JSQLParserException {
163
170
String sqlStr =
You can’t perform that action at this time.
0 commit comments