@@ -3506,7 +3506,7 @@ fn parse_create_table_on_cluster() {
35063506 let sql = "CREATE TABLE t ON CLUSTER '{cluster}' (a INT, b INT)" ;
35073507 match generic. verified_stmt ( sql) {
35083508 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( ) ) ;
35103510 }
35113511 _ => unreachable ! ( ) ,
35123512 }
@@ -3515,7 +3515,7 @@ fn parse_create_table_on_cluster() {
35153515 let sql = "CREATE TABLE t ON CLUSTER my_cluster (a INT, b INT)" ;
35163516 match generic. verified_stmt ( sql) {
35173517 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( ) ) ;
35193519 }
35203520 _ => unreachable ! ( ) ,
35213521 }
@@ -3824,13 +3824,26 @@ fn parse_alter_table() {
38243824
38253825#[ test]
38263826fn 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+ {
38293842 Statement :: AlterTable {
38303843 name, on_cluster, ..
38313844 } => {
38323845 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" ) ) ) ;
38343847 }
38353848 _ => unreachable ! ( ) ,
38363849 }
@@ -3839,7 +3852,7 @@ fn test_alter_table_with_on_cluster() {
38393852 . parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
38403853 std:: assert_eq!(
38413854 res. unwrap_err( ) ,
3842- ParserError :: ParserError ( "Expected: identifier or cluster literal , found: 123" . to_string( ) )
3855+ ParserError :: ParserError ( "Expected: identifier, found: 123" . to_string( ) )
38433856 )
38443857}
38453858
0 commit comments