Bundled at build time
The core featuresjson, parquet, and icu compile that extension into the embedded static
library (forwarded to better-duck-sys). The
extension is then available with no runtime INSTALL / LOAD — the right choice for offline and
embedded builds (Tauri, iOS) where downloading an extension at runtime isn’t an option.
Loaded at runtime
Extensions without a bundling feature — most notably spatial — load at runtime. TheConnection extension methods drive INSTALL / LOAD and read
duckdb_extensions(), so your code can check for and force-load an extension up front rather
than failing later with an opaque SQL error.
ensure_extension(name)— a no-op if already loaded, otherwiseLOAD, otherwiseINSTALL+LOAD.install_extension(name)→INSTALL name.load_extension(name)→LOAD name.is_extension_loaded(name) -> Result<bool>— queriesduckdb_extensions(); an unknown extension reportsfalse(no row), not an error.
Extension names must be bare identifiers (
[A-Za-z0-9_]+); anything else is rejected up front, so
the name can be embedded in SQL safely.Spatial through the Diesel backend
If you use the Diesel backend, itsspatial feature gates a module whose
ensure_loaded wraps the runtime load for the ST_* DSL functions. The feature carries no extra
Rust dependencies — the ST_* functions are plain SQL and ensure_loaded installs/loads at runtime
(so it needs network access unless the extension is already present). See the
Diesel SQL DSL.
Pointing in-memory data at SQL
Not an “extension” in the DuckDB sense, but worth knowing alongside them: thearrow and polars features let you register
in-memory Arrow streams and Polars DataFrames as queryable sources via
replacement scans — no extension and no copy into a table.
Writing your own extension
Writing a loadable.duckdb_extension in Rust uses the experimental
loadable-extension feature and the
#[duckdb_entrypoint] macro. This is distinct from using the extensions above:
it changes the whole linking model (no DuckDB
is linked in; every call routes through the host’s API table) and is not for a normal embedded app.
Related
Errors & Extensions
The full extension-management API reference.
Feature flags
json, parquet, icu, and every other core feature.SQL dialect & statements
The dialect those extensions plug into.
Arrow & Polars interop
Register in-memory data as a queryable source.