Postgres: Apply ONLY keyword per table in TRUNCATE stmt (#1872)

This commit is contained in:
Mohamed Abdeen 2025-06-06 08:10:03 +01:00 committed by GitHub
parent de2cc7b502
commit 4cf5e571d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 14 deletions

View file

@ -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
);
}