Skip to content

Conversation

@marksomething
Copy link

@marksomething marksomething commented Dec 28, 2025

Intending this to be a toe-in-the-water for building out vtab::Value (maybe should be renamed ValueHandle for consistency with LogicalTypeHandle?).

I was trying to create an extension (parsing fixed width binary files...) that needs non-integer parameters so looking to put the plumbing in to make that possible.

@marksomething marksomething marked this pull request as ready for review December 28, 2025 11:24
@marksomething marksomething marked this pull request as draft January 2, 2026 10:45
@mlafeldt
Copy link
Member

Do you need type introspection, or just extraction methods for non-integer types?


/// Returns a LogicalTypeHandle representing the type of this value.
pub fn logical_type(&self) -> LogicalTypeHandle {
// SAFETY: The returned LogicalTypeHandle frees allocated memory when dropped.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not true. duckdb_get_value_type returns a borrowed pointer to internal memory owned by the Value, not a new allocation. The C API docs say: "The type itself must not be destroyed". But LogicalTypeHandle::Drop calls duckdb_destroy_logical_type, causing double-free/corruption when dropped. I suggest returning an owned copy.

Alternatively, if sufficient, implement logical_type_id and return LogicalTypeId, which doesn't have this ownership problem.

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.

2 participants