feat: Add EXPLAIN support to SQL editor for PostgreSQL#377
Conversation
|
This PR was not deployed automatically as @ifeelBALANCED does not have access to the Railway project. In order to get automatic PR deploys, please add @ifeelBALANCED to your workspace on Railway. |
There was a problem hiding this comment.
Pull request overview
Adds PostgreSQL EXPLAIN execution support to the desktop SQL runner UI so users can view execution plans directly from the editor.
Changes:
- Adds global “Explain selected/all” button (Postgres-only) alongside the existing Run button.
- Adds per-query Explain icon action in editor query zones (Postgres-only) and extends runner context with
runExplain. - Introduces
wrapExplainQueryutility (with tests) and fixes result-row extraction to support KyselyQueryResultshapes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/desktop/src/routes/_protected/connection/$resourceId/query/-components/runner/runner.tsx | Adds Explain execution path + header button (Postgres-only). |
| apps/desktop/src/routes/_protected/connection/$resourceId/query/-components/runner/runner-editor-query-zones.tsx | Wires per-zone Explain handler and passes connection type into zone component. |
| apps/desktop/src/routes/_protected/connection/$resourceId/query/-components/runner/runner-editor-query-zone.tsx | Adds per-query Explain icon button (Postgres-only). |
| apps/desktop/src/routes/_protected/connection/$resourceId/query/-components/runner/runner-context.ts | Extends runner context API with QueryToRun and runExplain. |
| apps/desktop/src/routes/_protected/connection/$resourceId/query/-components/runner/index.ts | Fixes transforming results by extracting rows from non-array query results. |
| apps/desktop/src/entities/connection/utils/helpers.ts | Adds wrapExplainQuery helper to prepend EXPLAIN safely. |
| apps/desktop/src/entities/connection/utils/helpers.test.ts | Adds tests for wrapExplainQuery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Made-with: Cursor
…ture/keyboard-navigation
…ture/keyboard-navigation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <LoadingContent loading={isExplaining}> | ||
| <ContentSwitch | ||
| active={isExplaining} | ||
| activeContent={( | ||
| <RiCheckLine className="text-success" /> | ||
| )} | ||
| > | ||
| <RiQuestionLine /> | ||
| </ContentSwitch> |
There was a problem hiding this comment.
ContentSwitch is currently driven by isExplaining but shows a success check icon (RiCheckLine) as the active content. Because ContentSwitch auto-resets after ~3s, long-running EXPLAINs can end up showing the default icon again while still pending, and the check icon is shown during the request rather than on success. Use isExplainSuccess (and optionally onSwitchEnd) to drive the success check, and rely on LoadingContent for the pending spinner.
| seitu@0.7.0: | ||
| resolution: {integrity: sha512-Osx0uDAZG1s7nl1+j+/nBv8s+A1tGJBGTaJiqPCQsSiS1qy701BPed41zYYGRMGx4N7q4uyZvaShPbn+aA12Ig==} | ||
| engines: {node: '>=22'} |
There was a problem hiding this comment.
seitu@0.7.0 declares engines: { node: '>=22' }. Since the repo doesn’t currently declare/pin a Node version (root package.json only specifies Bun) and CI workflows install deps via pnpm install, this upgrade can cause install/runtime failures on environments still using Node <22. Consider explicitly pinning Node >=22 for contributors/CI (or reverting to a compatible seitu version).
| seitu@0.7.0: | |
| resolution: {integrity: sha512-Osx0uDAZG1s7nl1+j+/nBv8s+A1tGJBGTaJiqPCQsSiS1qy701BPed41zYYGRMGx4N7q4uyZvaShPbn+aA12Ig==} | |
| engines: {node: '>=22'} | |
| seitu@0.6.0: | |
| resolution: {integrity: sha512-REPLACE_WITH_REAL_SEITU_0_6_0_INTEGRITY_HASH==} | |
| engines: {node: '>=18'} |
…ture/keyboard-navigation
Description of Changes
What changed?
wrapExplainQueryutility to prependEXPLAINto queries without double-wrapping.rowsfrom the KyselyQueryResult.RunnerContextwithrunExplainandQueryToRun.Why?
Related: Closes Add explain to SQL editor #38
Checklist