File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -2164,7 +2164,7 @@ pub enum Statement {
2164
2164
location : Option < HiveSetLocation > ,
2165
2165
/// ClickHouse dialect supports `ON CLUSTER` clause for ALTER TABLE
2166
2166
/// For example: `ALTER TABLE table_name ON CLUSTER cluster_name ADD COLUMN c UInt32`
2167
- /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter)
2167
+ /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/update )
2168
2168
on_cluster : Option < String > ,
2169
2169
} ,
2170
2170
/// ```sql
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ use sqlparser::ast::Value::Number;
25
25
use sqlparser:: ast:: * ;
26
26
use sqlparser:: dialect:: ClickHouseDialect ;
27
27
use sqlparser:: dialect:: GenericDialect ;
28
- use sqlparser:: parser:: ParserError :: ParserError ;
29
28
30
29
#[ test]
31
30
fn parse_map_access_expr ( ) {
@@ -1092,27 +1091,6 @@ fn parse_create_table_on_commit_and_as_query() {
1092
1091
}
1093
1092
}
1094
1093
1095
- #[ test]
1096
- fn test_alter_table_with_on_cluster ( ) {
1097
- let sql = "ALTER TABLE t ON CLUSTER 'cluster' ADD CONSTRAINT bar PRIMARY KEY (baz)" ;
1098
- match clickhouse_and_generic ( ) . verified_stmt ( sql) {
1099
- Statement :: AlterTable {
1100
- name, on_cluster, ..
1101
- } => {
1102
- assert_eq ! ( name. to_string( ) , "t" ) ;
1103
- assert_eq ! ( on_cluster, Some ( "'cluster'" . to_string( ) ) ) ;
1104
- }
1105
- _ => unreachable ! ( ) ,
1106
- }
1107
-
1108
- let res = clickhouse_and_generic ( )
1109
- . parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
1110
- assert_eq ! (
1111
- res. unwrap_err( ) ,
1112
- ParserError ( "Expected: identifier or cluster literal, found: 123" . to_string( ) )
1113
- )
1114
- }
1115
-
1116
1094
fn clickhouse ( ) -> TestedDialects {
1117
1095
TestedDialects {
1118
1096
dialects : vec ! [ Box :: new( ClickHouseDialect { } ) ] ,
Original file line number Diff line number Diff line change @@ -3822,6 +3822,27 @@ fn parse_alter_table() {
3822
3822
}
3823
3823
}
3824
3824
3825
+ #[ test]
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) {
3829
+ Statement :: AlterTable {
3830
+ name, on_cluster, ..
3831
+ } => {
3832
+ std:: assert_eq!( name. to_string( ) , "t" ) ;
3833
+ std:: assert_eq!( on_cluster, Some ( "'cluster'" . to_string( ) ) ) ;
3834
+ }
3835
+ _ => unreachable ! ( ) ,
3836
+ }
3837
+
3838
+ let res = all_dialects ( )
3839
+ . parse_sql_statements ( "ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)" ) ;
3840
+ std:: assert_eq!(
3841
+ res. unwrap_err( ) ,
3842
+ ParserError :: ParserError ( "Expected: identifier or cluster literal, found: 123" . to_string( ) )
3843
+ )
3844
+ }
3845
+
3825
3846
#[ test]
3826
3847
fn parse_alter_index ( ) {
3827
3848
let rename_index = "ALTER INDEX idx RENAME TO new_idx" ;
You can’t perform that action at this time.
0 commit comments