Expand description
Projection + column read/write extraction.
Builds on the table/alias resolution from
(sql_resolve). Given a SqlStatementModel whose tables +
alias_scope are populated, this pass fills projection,
reads, and writes by walking the SELECT list, the
INSERT/UPDATE column targets, and the WHERE/SET/ON predicate
columns — attaching a ColumnResolution verdict to each.
Resolution rules:
alias.col→ look the alias up inAliasScope; if found,Resolved; if the alias isn’t bound,Unresolved.- bare
colwith exactly one table in scope →Resolvedagainst that table. - bare
colwith multiple tables in scope →Unresolved(ambiguous without catalog column lists; the catalog cross-check pass disambiguates later). */alias.*→StarExpansion.
§/oracle evidence
DATABASE-REFERENCE.mdPL/SQL Language Reference — the SELECT-list / SET-clause / predicate grammar defers to the SQL Language Reference.LOW-LEVEL-CATALOGS.mdData Dictionary View Families —ALL_TAB_COLUMNSis the authority that turns anUnresolvedbare column into aResolvedone once the catalog is available (deferred to a later pass).
Functions§
- extract_
columns - Populate
projection,reads,writesonmodelfrom its raw text + already-resolvedtables/alias_scope.rawis the original SQL text (the model doesn’t keep it). - extract_
columns_ for_ model - Convenience: run
extract_columnsover every statement in aSqlSemanticModel. The caller supplies the raw text per statement (the model is text-free by design).