Restore typing-time column-typo hint for SQL expressions via known-function list #16

Closed
opened 2026-05-28 23:03:50 +01:00 by oliversturm · 1 comment
oliversturm commented 2026-05-28 23:03:50 +01:00 (Migrated from github.com)

The function-call validator fix removed invalid_ident_at_cursor's "No such column" flag at sql_expr_ident positions — necessary to stop the false positive on function names like sum, but it cost the typing-time signal for genuine column typos in incomplete SQL expressions (e.g. typing select Agx before adding FROM).

What still works

  • Once FROM is in scope, the schema-existence pass fires and the diagnostic-driven hint at pick_hint_diagnostic surfaces "no such column: Agx". So the typo is visible at typing time for any expression-with-scope.
  • The trade-off is narrow: it only affects partials in scopes the schema-existence pass already silently skipped ("no FROM in scope — engine catches"). Before the fix, typing-time was actually more eager than submit-time — now they agree.

What this ticket would restore

A curated known-function list. Then at sql_expr_ident positions the check can stay strict: flag the partial as "no such column" only if it doesn't prefix-match any known function name AND doesn't prefix-match any schema column. That gets the early-warning signal back without re-introducing the false positive.

Scope to settle

  • Curate the function list: aggregates + common scalars (likely the same set as the parallel ticket on Tab completion of function names).
  • Share infrastructure with that ticket — a single source of truth for "what SQL function names this playground recognises".

Related

  • Surfaced as a deliberate trade-off during the /runda round on the function-call validation fix.
  • The trade-off lockdown test genuine_column_typo_in_complete_select_still_hints_via_diagnostic pins what does still work; this ticket closes the gap for incomplete inputs.
The function-call validator fix removed `invalid_ident_at_cursor`'s "No such column" flag at `sql_expr_ident` positions — necessary to stop the false positive on function names like `sum`, but it cost the typing-time signal for genuine column typos in incomplete SQL expressions (e.g. typing `select Agx` before adding `FROM`). ### What still works - Once FROM is in scope, the schema-existence pass fires and the diagnostic-driven hint at `pick_hint_diagnostic` surfaces `"no such column: Agx"`. So the typo *is* visible at typing time for any expression-with-scope. - The trade-off is narrow: it only affects partials in scopes the schema-existence pass already silently skipped ("no FROM in scope — engine catches"). Before the fix, typing-time was actually more eager than submit-time — now they agree. ### What this ticket would restore A curated **known-function list**. Then at `sql_expr_ident` positions the check can stay strict: flag the partial as "no such column" only if it doesn't prefix-match any known function name AND doesn't prefix-match any schema column. That gets the early-warning signal back without re-introducing the false positive. ### Scope to settle - Curate the function list: aggregates + common scalars (likely the same set as the parallel ticket on Tab completion of function names). - Share infrastructure with that ticket — a single source of truth for "what SQL function names this playground recognises". ### Related - Surfaced as a deliberate trade-off during the /runda round on the function-call validation fix. - The trade-off lockdown test `genuine_column_typo_in_complete_select_still_hints_via_diagnostic` pins what *does* still work; this ticket closes the gap for incomplete inputs.
oliversturm commented 2026-06-02 15:40:42 +01:00 (Migrated from github.com)

Resolved by ADR-0022 Amendment 6 (commit 6d8c9ee): the typing-time column-typo hint is restored for SQL expressions — invalid_ident_at_cursor bails only when the partial prefix-matches a known function, else falls through to the schema-column check (so select Agx warns, select sum does not). See docs/handoff/20260602-handoff-53.md.

Resolved by ADR-0022 Amendment 6 (commit 6d8c9ee): the typing-time column-typo hint is restored for SQL expressions — invalid_ident_at_cursor bails only when the partial prefix-matches a known function, else falls through to the schema-column check (so `select Agx` warns, `select sum` does not). See docs/handoff/20260602-handoff-53.md.
Sign in to join this conversation.