Expand description
Semantic analysis: name resolution, type checking, and scope validation.
§⚠️ ENGINE-UNUSED — FALSE-GREEN TRAP (bd-parser-semantic-orphan-qcv9u)
Nothing in the FrankenSQLite engine uses this module. Real query
name resolution happens in fsqlite-core’s connection.rs via the
connection-owned resolver types (SelectRelationResolver,
SelectStructureResolver, SelectColumnReferenceResolver,
CteResultMetadataResolver). This module is a standalone resolver
exercised only by semantic_test.rs in this crate.
Do NOT land engine resolution fixes here. A change here can turn
semantic_test.rs green while changing engine behavior not at all —
a false-green failure class this repository has been bitten by. If you
were routed here by a resolution bug, the fix belongs in
crates/fsqlite-core/src/connection.rs (search the resolver type names
above). Wiring this module into the engine is a deliberate architecture
decision tracked by bd-parser-semantic-orphan-qcv9u — do not do it as a
side effect of a bug fix, and do not delete this module without express
authorization.
Validates AST nodes against a schema to ensure:
- Column references resolve to known tables/columns
- Table aliases are unique within a query scope
- Function arity matches known functions
- CTE names are visible in the correct scope
- Type affinity is tracked for expression results
§Usage
let schema = Schema::new();
schema.add_table(TableDef { name: "users", columns: vec![...] });
let mut resolver = Resolver::new(&schema);
let errors = resolver.resolve_statement(&stmt);Structs§
- Column
Def - A column definition in the schema.
- Resolver
- The semantic analyzer / name resolver.
- Schema
- The database schema: a collection of table definitions.
- Scope
- A name scope for query resolution. Scopes nest for subqueries and CTEs.
- Semantic
Error - A semantic analysis error.
- Semantic
Metrics Snapshot - Point-in-time snapshot of semantic analysis metrics.
- Table
Def - A table definition in the schema.
Enums§
- Function
Arity - Expected function arity.
- Resolve
Result - Result of resolving a column reference.
- Semantic
Error Kind - Kinds of semantic errors.
Functions§
- reset_
semantic_ metrics - Reset semantic metrics.
- semantic_
metrics_ snapshot - Take a point-in-time snapshot of semantic metrics.