Skip to content

fix: report the correct error message on trigger node.sql failure#10197

Merged
asheshv merged 1 commit into
pgadmin-org:masterfrom
asheshv:fix/trigger-node-sql-errormsg
Jul 24, 2026
Merged

fix: report the correct error message on trigger node.sql failure#10197
asheshv merged 1 commit into
pgadmin-org:masterfrom
asheshv:fix/trigger-node-sql-errormsg

Conversation

@asheshv

@asheshv asheshv commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #10177 (merged) — review of that PR flagged an adjacent, pre-existing bug in the same function it touched.

Bug

In TriggerFunctionView (or equivalent trigger-function-info flow), after resolving the trigger function's node.sql data:

status, res = self.conn.execute_2darray(sql)
if not status:
    return internal_server_error(errormsg=rset)

rset is the result dict from the earlier, already-successful get_function_oid.sql query — not the error from the query that actually failed. Any failure on this second query (permissions, catalog access error) surfaces a stale/misleading payload instead of the real cause, making it undiagnosable.

Fix

errormsg=res — the actual error string from the failed query, consistent with every other error-handling call site in this file (errormsg=res pattern used ~10 other times).

Testing

ast.parse clean, pycodestyle clean. No behavior change on the success path; only the error message on this one failure path changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when loading database trigger details.
    • Error responses now display the correct query failure information.

The failure path for the second query (node.sql, resolving the
trigger function's node data) reported errormsg=rset — the result
dict from the first, already-successful get_function_oid.sql query
— instead of res, the actual error from the failed query. Any
failure here (permissions, catalog access) surfaced a stale,
misleading payload instead of the real cause.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f5869fa6-2214-44cf-9da8-8842fc5f6695

📥 Commits

Reviewing files that changed from the base of the PR and between 1e12400 and 346d59a.

📒 Files selected for processing (1)
  • web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py

Walkthrough

Corrects TriggerView.get_children_nodes so an internal server error reports the result of the query that failed.

Changes

Trigger query handling

Layer / File(s) Summary
Correct failing-query error response
web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
The second query’s error response now uses res rather than the earlier rset result.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: kundansable

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing incorrect error reporting when trigger node.sql retrieval fails.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@asheshv
asheshv merged commit 7339eb8 into pgadmin-org:master Jul 24, 2026
34 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.

1 participant