Skip to content

Commit d6b2379

Browse files
authored
Fixed an issue where EXPLAIN should run on query under cursor if no text is selected. #9297
1 parent 39c2f39 commit d6b2379

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/en_US/query_tool.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ the drop down on the right side of *Explain Analyze* button in the toolbar.
275275

276276
Please note that pgAdmin generates the *Explain [Analyze]* plan in JSON format.
277277

278+
**Note**: If multiple queries are present and none is selected, *Explain [Analyze]* runs the query located at the cursor position.
279+
278280
On successful generation of *Explain* plan, it will create three tabs/panels
279281
under the Explain panel.
280282

web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ export default function Query({onTextSelect, setQtStatePartial}) {
146146
const regex = /\$SELECTION\$/gi;
147147
query = macroSQL.replace(regex, query);
148148
external = true;
149-
} else if(executeCursor) {
150-
/* Execute query at cursor position */
149+
} else if(executeCursor || explainObject) {
150+
/* Execute query at cursor position or explain query at cursor position */
151151
query = query || editor.current?.getQueryAt(editor.current?.state.selection.head).value || '';
152152
} else {
153153
/* Normal execution */

0 commit comments

Comments
 (0)