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) {
11511151 }
11521152
11531153 @ 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+ }
11561159 return null ;
11571160 }
11581161
Original file line number Diff line number Diff line change @@ -152,12 +152,19 @@ public void testInsertSelect() throws Exception {
152152 }
153153
154154 @ Test
155- public void testCreateSelect () throws Exception {
155+ public void testCreateTableSelect () throws Exception {
156156 String sqlStr = "CREATE TABLE mytable AS SELECT mycolumn FROM mytable2" ;
157157 assertThat (TablesNamesFinder .findTables (sqlStr )).containsExactlyInAnyOrder ("mytable" ,
158158 "mytable2" );
159159 }
160160
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+
161168 @ Test
162169 public void testInsertSubSelect () throws JSQLParserException {
163170 String sqlStr =
You can’t perform that action at this time.
0 commit comments