Skip to content

Commit 5073edf

Browse files
authored
Remove redundant flush and close calls in Appender Drop (#564)
`duckdb_appender_destroy` already handles flushing and closing internally, making explicit calls unnecessary and potentially unsafe for partial rows. The C API documentation confirms this behavior: ```c /*! Closes the appender by flushing all intermediate states to the table and destroying it. By destroying it, this function de-allocates all memory associated with the appender. If flushing the data triggers a constraint violation, then all data is invalidated, and this function returns DuckDBError. Due to the destruction of the appender, it is no longer possible to obtain the specific error message with duckdb_appender_error. Therefore, call duckdb_appender_close before destroying the appender, if you need insights into the specific error. * @param appender The appender to flush, close and destroy. * @return `DuckDBSuccess` on success or `DuckDBError` on failure. */ DUCKDB_C_API duckdb_state duckdb_appender_destroy(duckdb_appender *appender); ``` Fixes #266
2 parents 803459f + 8b928cc commit 5073edf

File tree

1 file changed

+0
-2
lines changed
  • crates/duckdb/src/appender

1 file changed

+0
-2
lines changed

crates/duckdb/src/appender/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ impl Appender<'_> {
161161
impl Drop for Appender<'_> {
162162
fn drop(&mut self) {
163163
if !self.app.is_null() {
164-
let _ = self.flush(); // can't safely handle failures here
165164
unsafe {
166-
ffi::duckdb_appender_close(self.app);
167165
ffi::duckdb_appender_destroy(&mut self.app);
168166
}
169167
}

0 commit comments

Comments
 (0)