Advanced mode: explain not yet supported
#7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observed
In simple mode,
explain show data <T>/explain update .../explain delete ...work and render a styledEXPLAIN QUERY PLANtree (ADR-0028).In advanced mode, the equivalent SQL entry points (e.g.
explain select * from Customers) are not yet wired up.Expected
Advanced mode should support
explainfor at leastselect,update,delete— same plan-tree rendering as simple mode.EXPLAIN QUERY PLANdoesn't execute the wrapped statement, so this is safe for destructive verbs as well.Status
Known pre-existing gap; tracker.
Implemented in
f62ccce(ADR-0039, marked implemented).explainnow wraps the advanced-mode SQL commands —select,with(CTE),insert,update,delete— in addition to the DSLshow data/update/deleteit already covered, rendering through the same ADR-0028 span-styled plan tree. Advanced mode only for the SQL inner; DSLexplainunchanged in both modes.Approach: a second
AdvancedexplainCommandNode (EXPLAIN_SQL) registered under the sharedexplainentry word, reusing the establishedinsert/update/deleteshared-word dispatch (SQL-first, DSL-fallback) — no new grammar machinery.build_explain_sqlslices the inner SQL off the source (excludes theexplainprefix) and reuses the existing SQL builders;do_explain_planrunsEXPLAIN QUERY PLANover the carried text verbatim, no params.EXPLAIN QUERY PLANnever executes, so it's safe for the destructive verbs.Verified end-to-end in the live TUI (not just unit tests): each verb renders a plan tree;
explain show datastill works in advanced mode (DSL fallback); the plan flips SCAN→index SEARCH once an index exists; explain of update/delete/insert does not mutate data;explain create table …(DDL) is rejected; and the hint afterexplainoffersselect/with/insert/update/delete/show.Notes: advanced
explain update/deletenow route through SQL (identical plan, full SQL syntax); DSL-explain tests pinned to simple mode. AVALUESinsert has no query plan in SQLite, soexplain insert … values (…)shows the SQL with an empty tree (correct). The terse[ok] explain <Table>echo is pre-existing (issue #9).23 tests added (parsing, completion, execution against real SQLite, plus a REGISTRY help-id-uniqueness invariant). Full suite 2085/0/1, clippy clean. Docs: ADR-0039 status→implemented + Implementation section, README index, requirements.md QA1, CLAUDE.md, and help/usage text.