mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 14:28:22 +00:00
Allow to use ON CLUSTER cluster_name in TRUNCATE syntax (#1428)
This commit is contained in:
parent
246838a69f
commit
1c505ce736
4 changed files with 38 additions and 2 deletions
|
@ -10804,3 +10804,24 @@ fn test_extract_seconds_single_quote_err() {
|
|||
"sql parser error: Expected: date/time field, found: 'seconds'"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_truncate_table_with_on_cluster() {
|
||||
let sql = "TRUNCATE TABLE t ON CLUSTER cluster_name";
|
||||
match all_dialects().verified_stmt(sql) {
|
||||
Statement::Truncate { on_cluster, .. } => {
|
||||
assert_eq!(on_cluster, Some(Ident::new("cluster_name")));
|
||||
}
|
||||
_ => panic!("Expected: TRUNCATE TABLE statement"),
|
||||
}
|
||||
|
||||
// Omit ON CLUSTER is allowed
|
||||
all_dialects().verified_stmt("TRUNCATE TABLE t");
|
||||
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Expected: identifier, found: EOF".to_string()),
|
||||
all_dialects()
|
||||
.parse_sql_statements("TRUNCATE TABLE t ON CLUSTER")
|
||||
.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue