diff --git a/CHANGELOG.md b/CHANGELOG.md index db49a3af4..1b6de06f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. From versio ## Unreleased +### Fixed + +- Fix connection retrying message in `PGRST000` error by @netqo in #4980 + + Remove redundant "Retrying the connection." from message because it is logged separately + ## [14.12] - 2026-05-20 ### Fixed diff --git a/src/PostgREST/Error.hs b/src/PostgREST/Error.hs index 5e79cd04f..d132d8232 100644 --- a/src/PostgREST/Error.hs +++ b/src/PostgREST/Error.hs @@ -541,7 +541,7 @@ instance ErrorBody SQL.UsageError where code (SQL.SessionUsageError (SQL.QueryError _ _ e)) = code e code SQL.AcquisitionTimeoutUsageError = "PGRST003" - message (SQL.ConnectionUsageError _) = "Database connection error. Retrying the connection." + message (SQL.ConnectionUsageError _) = "Database connection error." message (SQL.SessionUsageError (SQL.QueryError _ _ e)) = message e message SQL.AcquisitionTimeoutUsageError = "Timed out acquiring connection from connection pool." diff --git a/test/io/test_io.py b/test/io/test_io.py index 65eeaa0dd..ec690d8e8 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -1756,6 +1756,15 @@ def test_log_listener_connection_start(defaultenv): ) +def test_connection_error_message_does_not_claim_retry(defaultenv): + "The connection error message should not claim retrying, since PostgREST stops on fatal errors." + uri = f'postgresql://?dbname={defaultenv["PGDATABASE"]}&host={defaultenv["PGHOST"]}&user=some_protected_user&password=invalid_pass' + env = {**defaultenv, "PGRST_DB_URI": uri} + with run(env=env, no_startup_stdout=False, wait_for=None) as postgrest: + output = postgrest.read_stdout(nlines=8) + assert any('"message":"Database connection error."' in line for line in output) + + def test_db_pre_config_with_pg_reserved_words(defaultenv): "The db-pre-config should not fail unexpectedly when function name is a postgres reserved word"