Skip to main content

SqlCatalog

Trait SqlCatalog 

Source
pub trait SqlCatalog {
    // Required method
    fn get_collection(
        &self,
        name: &str,
    ) -> Result<Option<CollectionInfo>, SqlCatalogError>;
}
Expand description

Trait for looking up collection metadata during planning.

Both Origin (via CredentialStore) and Lite (via the embedded redb catalog) implement this trait.

The return type is Result<Option<CollectionInfo>, _> with a three-way semantics:

  • Ok(Some(info)) — the collection exists and is usable. An Origin implementation will have acquired a descriptor lease at the current version before returning; subsequent planning against the same collection within the lease window is drain-safe.
  • Ok(None) — the collection does not exist. Callers should surface this as SqlError::UnknownTable.
  • Err(SqlCatalogError::RetryableSchemaChanged { .. }) — the collection exists but a DDL drain is in progress. Callers propagate this up so the pgwire layer can retry the whole statement.

Required Methods§

Implementors§