You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P0][bug] executeExplain/executeExplainAnalyze use raw EXPLAIN ${sql} string concat — trailing ; fails for EXPLAIN ANALYZE; multi-statement fails outright #418
EXPLAIN / EXPLAIN ANALYZE in SQLPilot is implemented via string concatenation in resultStore.
Problem
src/stores/resultStore.ts:103-117 (executeExplain) and 119-136 (executeExplainAnalyze) use raw EXPLAIN ${sql} string concat. Editor F34 noted: if sql ends with ;, the result is EXPLAIN SELECT 1;; (double semicolon). EXPLAIN tolerates this; EXPLAIN ANALYZE raises ERROR 1064 (42000): You have an error in your SQL syntax…near 'EXPLAIN ANALYZE SELECT 1;;'. The QueryToolbar passes editor.getValue() which includes the trailing ; per convention. EXPLAIN ANALYZE fails silently with a confusing error. Additionally, a multi-statement SQL SELECT 1; SELECT 2; gets prefixed with EXPLAIN and submitted as one — MySQL returns ERROR 1064 for multi-statement EXPLAIN.
Files
src/stores/resultStore.ts:103-117
src/stores/resultStore.ts:119-136
Repro
Open query tab, type SELECT 1; (with trailing semicolon)
Click Explain → EXPLAIN ANALYZE
MySQL returns error 1064 — confusing for the user
Expected
EXPLAIN ANALYZE SELECT 1; (trailing ;) executes successfully. Multi-statement SELECT 1; SELECT 2; shows "EXPLAIN supports a single statement".
Proposed fix
(1) const trimmed = sql.replace(/;\s*$/, '') before string concat. (2) Reject multi-statement SQL with a clear error: "EXPLAIN supports a single statement — split your script and re-run". Scope: S.
Acceptance
EXPLAIN ANALYZE SELECT 1; (trailing ;) executes successfully. Multi-statement SELECT 1; SELECT 2; shows "EXPLAIN supports a single statement".
Activity
fix(explain): stop EXPLAIN ANALYZE running writes, and make timeouts …