use super::{
AnalyzerPhase, Arc, BTreeMap, CommandExactIndex, DocId, Document, Engine, FieldName,
IVFIndexParams, RelationIdentity, SQLError, StorageBackendError, StorageBackendResult,
TableState, Value,
};
use crate::CatalogIndexRow;
enum IndexConflictProbe {
Unanswerable,
NoConflict,
Conflict(DocId),
}
fn table_not_found(table: &str) -> StorageBackendError {
StorageBackendError::Other(format!("table `{table}` does not exist"))
}
pub(crate) use uqa_sql::schema::dependencies::rewrites::upgrade_legacy_schema_function_dispatches;
use uqa_sql::schema::dependencies::rewrites::{
schema_expr_references_relation, stored_relation_reference_matches,
};
pub(crate) use uqa_sql::schema::dependencies::schema_expr_references_column;
pub(crate) fn rename_schema_expr_column(
expression: &mut uqa_sql::ast::Expr,
from: &str,
to: &str,
) -> StorageBackendResult<()> {
uqa_sql::schema::dependencies::rewrites::rename_schema_expr_column(expression, from, to)
.map_err(StorageBackendError::Other)
}
fn rename_schema_expr_relation(
expression: &mut uqa_sql::ast::Expr,
from: &RelationIdentity,
to: &str,
) -> StorageBackendResult<()> {
uqa_sql::schema::dependencies::rewrites::rename_schema_expr_relation(expression, from, to)
.map_err(StorageBackendError::Other)
}
fn rename_schema_expr_qualified_column(
expression: &mut uqa_sql::ast::Expr,
table: &RelationIdentity,
from: &str,
to: &str,
) -> StorageBackendResult<()> {
uqa_sql::schema::dependencies::rewrites::rename_schema_expr_qualified_column(
expression, table, from, to,
)
.map_err(StorageBackendError::Other)
}
mod columns;
mod constraints;
pub(crate) use constraints::{
foreign_keys_match_without_object_id, materialize_constraint_metadata,
table_next_id_metadata_key,
};
mod dependencies;
mod documents;
mod fts;
mod persistent;
mod table_lifecycle;
pub(crate) fn document_store_write_error(err: &StorageBackendError) -> SQLError {
SQLError::Internal(format!("document store write failed: {err}"))
}
pub(crate) fn document_store_read_error(action: &str, err: &StorageBackendError) -> SQLError {
SQLError::Internal(format!("{action} failed: {err}"))
}
#[cfg(test)]
mod tests;
mod truncate;
mod reads;