Skip to main content

MAX_STRING_LEN

Constant MAX_STRING_LEN 

Source
pub const MAX_STRING_LEN: usize = _; // 4_294_967_295usize
Expand description

The longest VARCHAR or BLOB value DuckDB can store, in bytes: string_t::MAX_STRING_SIZE, which is u32::MAX because the length field of a duckdb_string_t is a u32.

DuckDB does not enforce it when a value is written through the C API: StringVector::AddStringOrBlob narrows the 64-bit length with a plain cast in release builds, so a longer value is stored as its length modulo 2^32 — truncated, and for a VARCHAR possibly cut inside a UTF-8 sequence. VectorWriter::write_varchar and its siblings check this limit first.