Skip to main content

ReplacementScan

Trait ReplacementScan 

Source
pub trait ReplacementScan {
    // Required method
    fn replace(table_name: &str, info: &ReplacementScanInfo) -> UdfResult<()>;
}
Expand description

A hook that rewrites an unresolved table reference into a table function call. See the module docs for the v1 scope restriction (no SQL execution).

Stateless by design, matching VTab/VScalar: Self is never constructed, only used as a marker type for Database::register_replacement_scan.

Required Methods§

Source

fn replace(table_name: &str, info: &ReplacementScanInfo) -> UdfResult<()>

Called whenever DuckDB can’t resolve table_name to an existing table, view, or CTE. Call info.set_function_name(...) (optionally followed by info.add_parameter(...)) to rewrite it into a table function call; otherwise leave info untouched to decline, and DuckDB reports its normal “table not found” error.

§Errors

Returns an error to fail the query with that message instead of DuckDB’s default “table not found”.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§