@@ -3506,7 +3506,7 @@ fn parse_create_table_on_cluster() {
3506
3506
let sql = "CREATE TABLE t ON CLUSTER '{cluster}' (a INT, b INT)" ;
3507
3507
match generic. verified_stmt ( sql) {
3508
3508
Statement :: CreateTable ( CreateTable { on_cluster, .. } ) => {
3509
- assert_eq ! ( on_cluster. unwrap( ) , "'{cluster}'" . to_string( ) ) ;
3509
+ assert_eq ! ( on_cluster. unwrap( ) . to_string ( ) , "'{cluster}'" . to_string( ) ) ;
3510
3510
}
3511
3511
_ => unreachable ! ( ) ,
3512
3512
}
@@ -3515,7 +3515,7 @@ fn parse_create_table_on_cluster() {
3515
3515
let sql = "CREATE TABLE t ON CLUSTER my_cluster (a INT, b INT)" ;
3516
3516
match generic. verified_stmt ( sql) {
3517
3517
Statement :: CreateTable ( CreateTable { on_cluster, .. } ) => {
3518
- assert_eq ! ( on_cluster. unwrap( ) , "my_cluster" . to_string( ) ) ;
3518
+ assert_eq ! ( on_cluster. unwrap( ) . to_string ( ) , "my_cluster" . to_string( ) ) ;
3519
3519
}
3520
3520
_ => unreachable ! ( ) ,
3521
3521
}
@@ -3824,13 +3824,26 @@ fn parse_alter_table() {
3824
3824
3825
3825
#[ test]
3826
3826
fn test_alter_table_with_on_cluster ( ) {
3827
- let sql = "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" ;
3828
- match all_dialects ( ) . verified_stmt ( sql) {
3827
+ match all_dialects ( )
3828
+ . verified_stmt ( "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" )
3829
+ {
3830
+ Statement :: AlterTable {
3831
+ name, on_cluster, ..
3832
+ } => {
3833
+ std:: assert_eq!( name. to_string( ) , "t" ) ;
3834
+ std:: assert_eq!( on_cluster, Some ( Ident :: with_quote( '\'' , "cluster" ) ) ) ;
3835
+ }
3836
+ _ => unreachable ! ( ) ,
3837
+ }
3838
+
3839
+ match all_dialects ( )
3840
+ . verified_stmt ( "ALTER TABLE t ON CLUSTER cluster_name ADD CONSTRAINT bar PRIMARY KEY (baz)" )
3841
+ {
3829
3842
Statement :: AlterTable {
3830
3843
name, on_cluster, ..
3831
3844
} => {
3832
3845
std:: assert_eq!( name. to_string( ) , "t" ) ;
3833
- std:: assert_eq!( on_cluster, Some ( "'cluster'" . to_string ( ) ) ) ;
3846
+ std:: assert_eq!( on_cluster, Some ( Ident :: new ( "cluster_name" ) ) ) ;
3834
3847
}
3835
3848
_ => unreachable ! ( ) ,
3836
3849
}
@@ -3839,7 +3852,7 @@ fn test_alter_table_with_on_cluster() {
3839
3852
. parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
3840
3853
std:: assert_eq!(
3841
3854
res. unwrap_err( ) ,
3842
- ParserError :: ParserError ( "Expected: identifier or cluster literal , found: 123" . to_string( ) )
3855
+ ParserError :: ParserError ( "Expected: identifier, found: 123" . to_string( ) )
3843
3856
)
3844
3857
}
3845
3858
0 commit comments