mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 23:14:07 +00:00
Postgres: Apply ONLY
keyword per table in TRUNCATE stmt (#1872)
This commit is contained in:
parent
de2cc7b502
commit
4cf5e571d3
5 changed files with 44 additions and 14 deletions
|
@ -15302,3 +15302,31 @@ fn test_open() {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_truncate_only() {
|
||||
let truncate = all_dialects().verified_stmt("TRUNCATE TABLE employee, ONLY dept");
|
||||
|
||||
let table_names = vec![
|
||||
TruncateTableTarget {
|
||||
name: ObjectName::from(vec![Ident::new("employee")]),
|
||||
only: false,
|
||||
},
|
||||
TruncateTableTarget {
|
||||
name: ObjectName::from(vec![Ident::new("dept")]),
|
||||
only: true,
|
||||
},
|
||||
];
|
||||
|
||||
assert_eq!(
|
||||
Statement::Truncate {
|
||||
table_names,
|
||||
partitions: None,
|
||||
table: true,
|
||||
identity: None,
|
||||
cascade: None,
|
||||
on_cluster: None,
|
||||
},
|
||||
truncate
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue