Add src/dsl/sql_functions.rs (KNOWN_SQL_FUNCTIONS) as the shared source of truth at sql_expr_ident slots: - #15: offer the functions as Tab candidates under a new CandidateKind::Function + ninth Theme colour tok_function (blue, distinct from keyword/identifier/type). - #16: restore the column-typo flag the #6 fix had dropped wholesale — invalid_ident_at_cursor now bails only when the partial prefix-matches a known function, else falls through to the schema-column check. A column named like a function (e.g. `count`) is deduped (column wins). `cast` is excluded — CAST(x AS type) is not a plain-call shape. The no-validation-allowlist posture stands: the list drives completion + the typo hint only, never parse-time acceptance. Docs: ADR-0022 Amendment 6, ADR-0031 status note, README index, requirements I3/I4 + refreshed test baseline.
This commit is contained in:
@@ -409,3 +409,24 @@ Later phases extend the same fragment:
|
||||
set the engine-neutrality posture and the no-allowlist rule.
|
||||
- `docs/simple-mode-limitations.md` — the DSL limits this grammar
|
||||
lifts for advanced mode (§1, §4).
|
||||
|
||||
## Status note — known-function list layered on the slot (2026-05-30)
|
||||
|
||||
The `sql_expr_ident` slot is `IdentSource::Columns` and, per §1 / §5,
|
||||
does **not** itself know which identifiers are function names — it
|
||||
optimises for the common case (a column reference) and admits the
|
||||
function-call shape structurally; §5 explicitly noted "function names
|
||||
are not completed … a typed function name simply is not a candidate".
|
||||
**ADR-0022 Amendment 6** layers a curated known-function list
|
||||
(`src/dsl/sql_functions.rs`) on top of this slot, consumed two ways:
|
||||
as Tab-completion candidates so a learner can discover `sum` / `upper`
|
||||
/ … (issue #15 — softening §5's "not completed" line to "completed
|
||||
from a curated pedagogical list, not an allowlist for validation"),
|
||||
and as the allow-list that lets the typing-time column-typo hint stay
|
||||
strict at this slot — flag a partial as "no such column" only when it
|
||||
matches neither a schema column nor a known function name (issue #16).
|
||||
The grammar here is unchanged, and §6/§7's no-validation-allowlist
|
||||
posture stands: the list drives completion + the typo hint, **not**
|
||||
parse-time acceptance (an unknown function still parses and surfaces an
|
||||
engine-neutral execution error). The list sits in the completion /
|
||||
hint layer above the grammar.
|
||||
|
||||
Reference in New Issue
Block a user