@@ -3429,6 +3429,32 @@ fn parse_create_table_as_table() {
3429
3429
}
3430
3430
}
3431
3431
3432
+ #[ test]
3433
+ fn parse_create_table_on_cluster ( ) {
3434
+ let generic = TestedDialects {
3435
+ dialects : vec ! [ Box :: new( GenericDialect { } ) ] ,
3436
+ options : None ,
3437
+ } ;
3438
+
3439
+ // Using single-quote literal to define current cluster
3440
+ let sql = "CREATE TABLE t ON CLUSTER '{cluster}' (a INT, b INT)" ;
3441
+ match generic. verified_stmt ( sql) {
3442
+ Statement :: CreateTable { on_cluster, .. } => {
3443
+ assert_eq ! ( on_cluster. unwrap( ) , "{cluster}" . to_string( ) ) ;
3444
+ }
3445
+ _ => unreachable ! ( ) ,
3446
+ }
3447
+
3448
+ // Using explicitly declared cluster name
3449
+ let sql = "CREATE TABLE t ON CLUSTER my_cluster (a INT, b INT)" ;
3450
+ match generic. verified_stmt ( sql) {
3451
+ Statement :: CreateTable { on_cluster, .. } => {
3452
+ assert_eq ! ( on_cluster. unwrap( ) , "my_cluster" . to_string( ) ) ;
3453
+ }
3454
+ _ => unreachable ! ( ) ,
3455
+ }
3456
+ }
3457
+
3432
3458
#[ test]
3433
3459
fn parse_create_or_replace_table ( ) {
3434
3460
let sql = "CREATE OR REPLACE TABLE t (a INT)" ;
@@ -3472,6 +3498,34 @@ fn parse_create_table_with_on_delete_on_update_2in_any_order() -> Result<(), Par
3472
3498
Ok ( ( ) )
3473
3499
}
3474
3500
3501
+ #[ test]
3502
+ fn parse_create_table_with_options ( ) {
3503
+ let generic = TestedDialects {
3504
+ dialects : vec ! [ Box :: new( GenericDialect { } ) ] ,
3505
+ options : None ,
3506
+ } ;
3507
+
3508
+ let sql = "CREATE TABLE t (c INT) WITH (foo = 'bar', a = 123)" ;
3509
+ match generic. verified_stmt ( sql) {
3510
+ Statement :: CreateTable { with_options, .. } => {
3511
+ assert_eq ! (
3512
+ vec![
3513
+ SqlOption {
3514
+ name: "foo" . into( ) ,
3515
+ value: Expr :: Value ( Value :: SingleQuotedString ( "bar" . into( ) ) ) ,
3516
+ } ,
3517
+ SqlOption {
3518
+ name: "a" . into( ) ,
3519
+ value: Expr :: Value ( number( "123" ) ) ,
3520
+ } ,
3521
+ ] ,
3522
+ with_options
3523
+ ) ;
3524
+ }
3525
+ _ => unreachable ! ( ) ,
3526
+ }
3527
+ }
3528
+
3475
3529
#[ test]
3476
3530
fn parse_create_table_clone ( ) {
3477
3531
let sql = "CREATE OR REPLACE TABLE a CLONE a_tmp" ;
0 commit comments