Skip to main content

validate_read_then_write_dependencies

Function validate_read_then_write_dependencies 

Source
pub(crate) fn validate_read_then_write_dependencies(
    catalog: &Catalog,
    ids: impl IntoIterator<Item = CatalogItemId>,
    max_rw_dependencies: usize,
) -> Result<(), AdapterError>
Expand description

Validates that all dependencies are valid for read-then-write operations.

Ensures all objects the selection transitively depends on (seeded by ids) are valid for ReadThenWrite operations:

  • They do not refer to any objects whose notion of time moves differently than that of user tables. This limitation is meant to ensure no writes occur between this read and the subsequent write.
  • They do not use mz_now(), whose time produced during read will differ from the write timestamp.

The first invalid or temporal dependency encountered short-circuits with the corresponding error. Traversal is bounded at max_rw_dependencies distinct objects, returning AdapterError::ReadThenWriteDependencyLimitExceeded if exceeded.