pub const MAX_LIST_CHILD_CAPACITY: u64 = _; // 137_438_953_472u64Expand description
DuckDB’s ceiling on one buffer of a child vector, in bytes
(DConstants::MAX_VECTOR_SIZE).
Vector::Resize (vector.cpp, identical in 1.4.4 and 1.5.5) computes
capacity * element size * multiplier for every buffer it grows — the
child’s own, each STRUCT field’s, and each ARRAY child’s, whose
multiplier is the array size — and throws an OutOfRangeException when
one exceeds this. duckdb_list_vector_reserve does not catch it, so the
exception unwinds into Rust and the process aborts (“Rust cannot catch
foreign exceptions”). DuckDB checks the capacity after rounding it up to
a power of two (VectorListBuffer::Reserve). The element limit therefore
depends on the child’s type: 2^34 BIGINTs, 2^33 VARCHARs, 2^37
BOOLEANs, 2^25 INTEGER[1000]s (not 2^37 / 4000).
ListBuilder computes it from the child’s type (max_child_capacity)
and refuses to make a call past it.
Until September 2026 this was documented, and applied, as an element
count: a BIGINT list of 2^34 + 1 elements passed the check and aborted
the process.
Staying below it is necessary, not sufficient: a reservation under the
ceiling that the allocator cannot satisfy throws through the same uncaught
path. Use ListBuilder::with_element_limit to bound lengths that come
from untrusted input.
Typed u64 to match duckdb::DConstants::MAX_VECTOR_SIZE, which is
1ULL << 37ULL — an idx_t, not a pointer-sized value. It does not fit in a
32-bit usize, so typing it as one made the crate fail to compile for
wasm32, which is a target DuckDB’s own extension CI builds.