File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ impl CreateTableBuilder {
386386 /// Returns true if information on the structure of the table
387387 /// to be created was provided to the builder. If not, the
388388 /// statement is invalid.
389- pub fn has_schema_info ( & self ) -> bool {
389+ pub ( crate ) fn has_schema_info ( & self ) -> bool {
390390 !self . columns . is_empty ( )
391391 || self . query . is_some ( )
392392 || self . like . is_some ( )
Original file line number Diff line number Diff line change @@ -997,19 +997,40 @@ fn test_snowflake_create_iceberg_table_without_location() {
997997
998998#[ test]
999999fn test_snowflake_create_table_trailing_options ( ) {
1000+ // Serialization to SQL assume that in `CREATE TABLE AS` the options come before the `AS (<query>)`
1001+ // but Snowflake supports also the other way around
1002+ snowflake ( )
1003+ . verified_stmt ( "CREATE TEMPORARY TABLE dst ON COMMIT PRESERVE ROWS AS (SELECT * FROM src)" ) ;
10001004 snowflake ( )
10011005 . parse_sql_statements (
1002- "CREATE TEMP TABLE dst AS (SELECT * FROM src) ON COMMIT PRESERVE ROWS" ,
1006+ "CREATE TEMPORARY TABLE dst AS (SELECT * FROM src) ON COMMIT PRESERVE ROWS" ,
10031007 )
10041008 . unwrap ( ) ;
1009+
1010+ // Same for `CREATE TABLE LIKE|CLONE`:
1011+ snowflake ( ) . verified_stmt ( "CREATE TEMPORARY TABLE dst LIKE src ON COMMIT PRESERVE ROWS" ) ;
10051012 snowflake ( )
1006- . parse_sql_statements ( "CREATE TEMP TABLE tbl LIKE customers ON COMMIT PRESERVE ROWS; " )
1013+ . parse_sql_statements ( "CREATE TEMPORARY TABLE dst ON COMMIT PRESERVE ROWS LIKE src " )
10071014 . unwrap ( ) ;
1015+
1016+ snowflake ( ) . verified_stmt ( "CREATE TEMPORARY TABLE dst CLONE src ON COMMIT PRESERVE ROWS" ) ;
10081017 snowflake ( )
1009- . parse_sql_statements ( "CREATE TEMP TABLE tbl CLONE customers ON COMMIT PRESERVE ROWS; " )
1018+ . parse_sql_statements ( "CREATE TEMPORARY TABLE dst ON COMMIT PRESERVE ROWS CLONE src " )
10101019 . unwrap ( ) ;
10111020}
10121021
1022+ #[ test]
1023+ fn test_snowflake_create_table_has_schema_info ( ) {
1024+ // The parser validates there's information on the schema of the new
1025+ // table, such as a list of columns or a source table\query to copy it from.
1026+ assert_eq ! (
1027+ snowflake( )
1028+ . parse_sql_statements( "CREATE TABLE dst" )
1029+ . is_err( ) ,
1030+ true
1031+ ) ;
1032+ }
1033+
10131034#[ test]
10141035fn parse_sf_create_or_replace_view_with_comment_missing_equal ( ) {
10151036 assert ! ( snowflake_and_generic( )
You can’t perform that action at this time.
0 commit comments