@@ -3495,7 +3495,7 @@ fn parse_create_table_on_cluster() {
34953495 let sql = "CREATE TABLE t ON CLUSTER '{cluster}' (a INT, b INT)" ;
34963496 match generic. verified_stmt ( sql) {
34973497 Statement :: CreateTable ( CreateTable { on_cluster, .. } ) => {
3498- assert_eq ! ( on_cluster. unwrap( ) , "'{cluster}'" . to_string( ) ) ;
3498+ assert_eq ! ( on_cluster. unwrap( ) . to_string ( ) , "'{cluster}'" . to_string( ) ) ;
34993499 }
35003500 _ => unreachable ! ( ) ,
35013501 }
@@ -3504,7 +3504,7 @@ fn parse_create_table_on_cluster() {
35043504 let sql = "CREATE TABLE t ON CLUSTER my_cluster (a INT, b INT)" ;
35053505 match generic. verified_stmt ( sql) {
35063506 Statement :: CreateTable ( CreateTable { on_cluster, .. } ) => {
3507- assert_eq ! ( on_cluster. unwrap( ) , "my_cluster" . to_string( ) ) ;
3507+ assert_eq ! ( on_cluster. unwrap( ) . to_string ( ) , "my_cluster" . to_string( ) ) ;
35083508 }
35093509 _ => unreachable ! ( ) ,
35103510 }
@@ -3813,13 +3813,22 @@ fn parse_alter_table() {
38133813
38143814#[ test]
38153815fn test_alter_table_with_on_cluster ( ) {
3816- let sql = "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" ;
3817- match all_dialects ( ) . verified_stmt ( sql) {
3816+ match all_dialects ( ) . verified_stmt ( "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" ) {
38183817 Statement :: AlterTable {
38193818 name, on_cluster, ..
38203819 } => {
38213820 std:: assert_eq!( name. to_string( ) , "t" ) ;
3822- std:: assert_eq!( on_cluster, Some ( "'cluster'" . to_string( ) ) ) ;
3821+ std:: assert_eq!( on_cluster, Some ( Ident :: with_quote( '\'' , "cluster" ) ) ) ;
3822+ }
3823+ _ => unreachable ! ( ) ,
3824+ }
3825+
3826+ match all_dialects ( ) . verified_stmt ( "ALTER TABLE t ON CLUSTER cluster_name ADD CONSTRAINT bar PRIMARY KEY (baz)" ) {
3827+ Statement :: AlterTable {
3828+ name, on_cluster, ..
3829+ } => {
3830+ std:: assert_eq!( name. to_string( ) , "t" ) ;
3831+ std:: assert_eq!( on_cluster, Some ( Ident :: new( "cluster_name" ) ) ) ;
38233832 }
38243833 _ => unreachable ! ( ) ,
38253834 }
@@ -3828,7 +3837,7 @@ fn test_alter_table_with_on_cluster() {
38283837 . parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
38293838 std:: assert_eq!(
38303839 res. unwrap_err( ) ,
3831- ParserError :: ParserError ( "Expected: identifier or cluster literal , found: 123" . to_string( ) )
3840+ ParserError :: ParserError ( "Expected: identifier, found: 123" . to_string( ) )
38323841 )
38333842}
38343843
0 commit comments