Skip to main content

Module cast

Module cast 

Source
Expand description

DuckDB custom cast functions: register a conversion from one logical type to another, used implicitly by the binder or explicitly via CAST.

A cast is defined by its source/target types, an implicit-cast cost (how eagerly the binder applies it), and a per-row conversion. DuckDB runs the conversion in two modes: a normal CAST (a conversion error fails the query) and a TRY_CAST (a conversion error yields NULL for that row instead). VCast::cast_row reports a row error and the trampoline routes it per the active mode.

Traitsยง

VCast
A DuckDB custom cast: converts values of a source logical type to a target type.