Skip to content

Fixed an issue where the Query tool kept prompting for a password when using a shared server. #9789#9790

Merged
khushboovashi merged 2 commits intopgadmin-org:masterfrom
pravesh-sharma:GH-9789
Mar 27, 2026
Merged

Fixed an issue where the Query tool kept prompting for a password when using a shared server. #9789#9790
khushboovashi merged 2 commits intopgadmin-org:masterfrom
pravesh-sharma:GH-9789

Conversation

@pravesh-sharma
Copy link
Copy Markdown
Contributor

@pravesh-sharma pravesh-sharma commented Mar 26, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved shared-server handling in the SQL Editor: when a server is shared by another user, the editor now resolves and uses the shared server’s properties for authentication and connection initialization. This prevents connection and access errors and ensures seamless use of shared database resources within the editor.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ddc96c1d-87d3-4d84-9b74-71c375515c7b

📥 Commits

Reviewing files that changed from the base of the PR and between 710a1c4 and 1938e02.

📒 Files selected for processing (1)
  • web/pgadmin/tools/sqleditor/__init__.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/pgadmin/tools/sqleditor/init.py

Walkthrough

_init_sqleditor now checks if a resolved Server is shared and owned by another user; if so, it dynamically imports ServerModule, calls get_shared_server() and get_shared_server_properties() to obtain and substitute the shared-server properties, and proceeds using the resolved server (affecting password/encpass derivation).

Changes

Cohort / File(s) Summary
Shared Server Resolution
web/pgadmin/tools/sqleditor/__init__.py
Added detection for server.shared owned by another user, dynamic import of ServerModule, call to ServerModule.get_shared_server(server, sgid), substitution of server via ServerModule.get_shared_server_properties(...), and use of resolved server for subsequent initialization (including encpass derivation).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 directly addresses the main fix: enabling the Query tool to work with shared servers without repeated password prompts by resolving shared server properties.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/pgadmin/tools/sqleditor/__init__.py`:
- Around line 516-521: The code calls ServerModule.get_shared_server(sgid) and
then immediately passes shared_server into
ServerModule.get_shared_server_properties(server, shared_server) which will
raise an AttributeError if get_shared_server returns None; add a None check
after obtaining shared_server and only call get_shared_server_properties when
shared_server is not None (otherwise leave server unchanged or handle the error
path as appropriate), and fix the indentation of the
get_shared_server_properties call so it aligns correctly with surrounding code
(adjust the indentation of the continued argument lines).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9e0fc8c4-8a59-41e0-b4f7-491cc3ba0bed

📥 Commits

Reviewing files that changed from the base of the PR and between 2576548 and 28e4131.

📒 Files selected for processing (1)
  • web/pgadmin/tools/sqleditor/__init__.py

@khushboovashi khushboovashi merged commit 1d51a1a into pgadmin-org:master Mar 27, 2026
33 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