Skip to content

Log PostgreSQL server failures as errors - #5882

Open
UllasSHR wants to merge 1 commit into
clockworklabs:masterfrom
UllasSHR:fix/pg-response-error-logging
Open

Log PostgreSQL server failures as errors#5882
UllasSHR wants to merge 1 commit into
clockworklabs:masterfrom
UllasSHR:fix/pg-response-error-logging

Conversation

@UllasSHR

@UllasSHR UllasSHR commented Sep 8, 2026

Copy link
Copy Markdown

Description of Changes

Log failed PostgreSQL responses according to their HTTP status: 5xx responses now use error!, while 4xx responses continue to use warn!. This lets internal failures classified upstream as server errors remain visible at the appropriate log level.

Adds a regression test that passes representative 400 and 500 responses through response(), checks the emitted log level, and verifies that the original error text is still returned.

Addresses #5695.

Interaction with #5869

#5869 classifies SQL execution failures as 400 or 500 in the client API and does not modify the PostgreSQL adapter. This change consumes that HTTP classification at the PostgreSQL boundary. It can merge independently; #5869 would increase the SQL execution failures that reach the 5xx branch.

Error responses can already be logged both where they originate and again at the PostgreSQL boundary. This change only corrects the severity of the PostgreSQL log for 5xx responses.

API and ABI breaking changes

None.

Rollback safety impact

n/a

Expected complexity level and risk

1 - The behavior change is limited to PostgreSQL response logging.

Testing

  • cargo test --locked --offline -p spacetimedb-pg --lib
  • cargo fmt --check -p spacetimedb-pg

@CLAassistant

CLAassistant commented Sep 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@UllasSHR
UllasSHR marked this pull request as ready for review September 8, 2026 07:17
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