Skip to content

fix: throw Postgre query errors with warnings disabled (#6913) - #10573

Open
wakqasahmed wants to merge 2 commits into
codeigniter4:developfrom
wakqasahmed:feature/issue-6913-postgre-exception
Open

wakqasahmed wants to merge 2 commits into
codeigniter4:developfrom
wakqasahmed:feature/issue-6913-postgre-exception

Conversation

@wakqasahmed

@wakqasahmed wakqasahmed commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Description

Throws DatabaseException when Postgre's pg_query() returns false with DBDebug enabled, even if PHP warnings are disabled — previously the failure was silently swallowed in that combination. Adds a Postgre regression test for the suppressed-warning query failure. Partially addresses #6913; OCI8 remains open, this PR does not close the issue.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Test plan

  • New test fails on develop and passes with the fix against a disposable Postgre test database.
  • BadQueryTest.php (3 tests, 4 assertions).
  • Focused Postgre transaction start and exception tests (2 tests, 4 assertions).
  • PHP syntax checks and git diff --check.

@wakqasahmed wakqasahmed changed the title Fix Postgre query errors when warnings are disabled (#6913) fix: throw Postgre query errors with warnings disabled (#6913) Sep 19, 2026
@carson-codeigniter4 carson-codeigniter4 Bot added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 19, 2026

@wakqasahmed wakqasahmed left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed 6d7297a against #6913. No actionable issues found.

The new failure path honors DBDebug, and BaseConnection::query() preserves default transaction exception suppression and transException(true) rollback behavior. The server error is captured before rollback can overwrite it. The regression restores error_reporting() in finally and uses the existing test database setup. The change is compatible with PHP 8.2.

Remaining validation: I did not rerun runtime tests during this review. The new regression covers warnings-disabled DBDebug=true outside transactions; warnings-disabled DBDebug=false and transaction cases have no additional regression tests. CI for this revision is still pending.

@paulbalandan

Copy link
Copy Markdown
Member

Hi @wakqasahmed ,

Thanks for your PR. Few reminders on your PRs:

  1. Use the pull request template when creating a PR.
  2. Do not post any review comments from your coding agent here. It should be resolved internally with yourself, and posting it just adds noise.

@michalsn michalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants