Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mlafeldt
Copy link
Member

@mlafeldt mlafeldt commented Aug 5, 2025

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:

/*!
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

`duckdb_appender_destroy` already handles flushing and closing
internally, making explicit calls unnecessary and potentially unsafe for
partial rows.
@mlafeldt mlafeldt self-assigned this Aug 5, 2025
@mlafeldt mlafeldt merged commit 5073edf into main Aug 5, 2025
3 checks passed
@mlafeldt mlafeldt deleted the fix-266-appender-drop branch August 5, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impl Drop for Appender has unnecessary unsafe calls.

2 participants