Skip to content

Conversation

@anilsahoo20
Copy link
Contributor

@anilsahoo20 anilsahoo20 commented Nov 18, 2025

…cript containing multiple queries causes the Data Output panel to appear. #9297

Summary by CodeRabbit

  • New Features

    • Explain Analyze now executes the query at cursor position when multiple queries exist and none is selected.
  • Documentation

    • Updated query tool documentation to clarify Explain Analyze behavior with multiple queries.

…cript containing multiple queries causes the Data Output panel to appear. pgadmin-org#9297
@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Walkthrough

Documentation is added to clarify that Explain Analyze runs at the cursor position when multiple queries exist and none is selected. The corresponding code logic is expanded to execute this behavior by including explainObject in the trigger condition alongside executeCursor.

Changes

Cohort / File(s) Change Summary
Explain Analyze cursor position behavior
docs/en_US/query_tool.rst, web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx
Added documentation note clarifying that Explain Analyze executes at cursor position when multiple queries exist and none is selected. Updated Query component's triggerExecution conditional to handle explainObject in addition to executeCursor, ensuring query retrieval from cursor position for both execution modes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify that the documentation note accurately reflects the implemented behavior in the conditional logic
  • Confirm that the explainObject condition correctly triggers cursor-position query execution
  • Test that Explain Analyze functions as specified when multiple queries are present with no selection

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is truncated and incomplete, but it clearly refers to fixing an issue in the Query Tool related to EXPLAIN [ANALYZE] operations, which aligns with the changeset's primary objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39c2f39 and d97ba10.

📒 Files selected for processing (2)
  • docs/en_US/query_tool.rst (1 hunks)
  • web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx (1)
web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx (1)
  • executeCursor (91-97)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: run-feature-tests-pg (15)
  • GitHub Check: run-feature-tests-pg (17)
  • GitHub Check: run-feature-tests-pg (18)
  • GitHub Check: run-feature-tests-pg (16)
  • GitHub Check: run-feature-tests-pg (13)
  • GitHub Check: run-feature-tests-pg (14)
  • GitHub Check: run-python-tests-pg (windows-latest, 13)
  • GitHub Check: run-python-tests-pg (windows-latest, 18)
  • GitHub Check: run-python-tests-pg (windows-latest, 14)
  • GitHub Check: run-python-tests-pg (windows-latest, 17)
🔇 Additional comments (2)
docs/en_US/query_tool.rst (1)

278-279: Documentation note clearly describes new Explain-at-cursor behavior

The added note is concise, matches the new cursor-based behavior for Explain [Analyze] with multiple queries and no selection, and is consistent with surrounding terminology. No changes needed.

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

149-151: Extending cursor-based execution to Explain/Explain Analyze looks correct; verify error-highlighting behavior

Including explainObject in the executeCursor branch cleanly reuses the existing “query at cursor” logic for Explain/Explain Analyze, which matches the intended behavior for multiple-query scripts with no selection and keeps selection/macro behavior unchanged.

One thing to double-check: the error-highlighting path (QUERY_TOOL_EVENTS.HIGHLIGHT_ERRORhighlightError(...)) currently adjusts offsets only when a selection is present or executeCursor is true. For Explain/Explain Analyze run at the cursor (where explainObject is truthy but executeCursor may still be false), the backend is now given only the query-at-cursor snippet rather than the whole script, so line/character positions in error messages might no longer line up with the full editor content.

It may be worth:

  • Either ensuring that the caller sets executeCursor=true as well when triggering Explain/Explain Analyze at the cursor, or
  • Extending highlightError (and the event payload) to recognize the explain-at-cursor case explicitly so offsets are calculated correctly in that scenario.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

@adityatoshniwal adityatoshniwal merged commit d6b2379 into pgadmin-org:master Nov 18, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants