@@ -1589,11 +1589,13 @@ fn parse_create_view() {
15891589 match verified_stmt ( sql) {
15901590 SQLStatement :: SQLCreateView {
15911591 name,
1592+ columns,
15921593 query,
15931594 materialized,
15941595 with_options,
15951596 } => {
15961597 assert_eq ! ( "myschema.myview" , name. to_string( ) ) ;
1598+ assert_eq ! ( Vec :: <SQLIdent >:: new( ) , columns) ;
15971599 assert_eq ! ( "SELECT foo FROM bar" , query. to_string( ) ) ;
15981600 assert ! ( !materialized) ;
15991601 assert_eq ! ( with_options, vec![ ] ) ;
@@ -1625,17 +1627,40 @@ fn parse_create_view_with_options() {
16251627 }
16261628}
16271629
1630+ #[ test]
1631+ fn parse_create_view_with_columns ( ) {
1632+ let sql = "CREATE VIEW v (has, cols) AS SELECT 1, 2" ;
1633+ match verified_stmt ( sql) {
1634+ SQLStatement :: SQLCreateView {
1635+ name,
1636+ columns,
1637+ with_options,
1638+ query,
1639+ materialized,
1640+ } => {
1641+ assert_eq ! ( "v" , name. to_string( ) ) ;
1642+ assert_eq ! ( columns, vec![ "has" . to_string( ) , "cols" . to_string( ) ] ) ;
1643+ assert_eq ! ( with_options, vec![ ] ) ;
1644+ assert_eq ! ( "SELECT 1, 2" , query. to_string( ) ) ;
1645+ assert ! ( !materialized) ;
1646+ }
1647+ _ => unreachable ! ( ) ,
1648+ }
1649+ }
1650+
16281651#[ test]
16291652fn parse_create_materialized_view ( ) {
16301653 let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar" ;
16311654 match verified_stmt ( sql) {
16321655 SQLStatement :: SQLCreateView {
16331656 name,
1657+ columns,
16341658 query,
16351659 materialized,
16361660 with_options,
16371661 } => {
16381662 assert_eq ! ( "myschema.myview" , name. to_string( ) ) ;
1663+ assert_eq ! ( Vec :: <SQLIdent >:: new( ) , columns) ;
16391664 assert_eq ! ( "SELECT foo FROM bar" , query. to_string( ) ) ;
16401665 assert ! ( materialized) ;
16411666 assert_eq ! ( with_options, vec![ ] ) ;
0 commit comments