@@ -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,22 @@ 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 ( ) . verified_stmt ( "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" ) {
38293828 Statement :: AlterTable {
38303829 name, on_cluster, ..
38313830 } => {
38323831 std:: assert_eq!( name. to_string( ) , "t" ) ;
3833- std:: assert_eq!( on_cluster, Some ( "'cluster'" . to_string( ) ) ) ;
3832+ std:: assert_eq!( on_cluster, Some ( Ident :: with_quote( '\'' , "cluster" ) ) ) ;
3833+ }
3834+ _ => unreachable ! ( ) ,
3835+ }
3836+
3837+ match all_dialects ( ) . verified_stmt ( "ALTER TABLE t ON CLUSTER cluster_name ADD CONSTRAINT bar PRIMARY KEY (baz)" ) {
3838+ Statement :: AlterTable {
3839+ name, on_cluster, ..
3840+ } => {
3841+ std:: assert_eq!( name. to_string( ) , "t" ) ;
3842+ std:: assert_eq!( on_cluster, Some ( Ident :: new( "cluster_name" ) ) ) ;
38343843 }
38353844 _ => unreachable ! ( ) ,
38363845 }
@@ -3839,7 +3848,7 @@ fn test_alter_table_with_on_cluster() {
38393848 . parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
38403849 std:: assert_eq!(
38413850 res. unwrap_err( ) ,
3842- ParserError :: ParserError ( "Expected: identifier or cluster literal , found: 123" . to_string( ) )
3851+ ParserError :: ParserError ( "Expected: identifier, found: 123" . to_string( ) )
38433852 )
38443853}
38453854
0 commit comments