pub fn load_vector_extension(
conn: &Connection,
path: Option<&Path>,
) -> Result<()>Expand description
Load the sqlite-vector extension
The extension binary should be available at the given path. Pre-built binaries can be downloaded from: https://github.com/sqliteai/sqlite-vector/releases
§Platform-specific defaults
If no path is provided, defaults to:
- Linux:
./libsqlite_vector.so - macOS:
./libsqlite_vector.dylib - Windows:
./sqlite_vector.dll
§Safety
This function uses unsafe because rusqlite::Connection::load_extension
calls sqlite3_load_extension, which loads a native shared library (.so / .dylib / .dll)
into the current process. Loading an untrusted library can execute arbitrary code.
Requirements for safe usage:
- The extension binary must come from a trusted, verified source (e.g., official releases).
- The
pathargument should never be derived from user-supplied input. - Consider validating file checksums before loading in production deployments.