From d4b8109522acbc40f1d7a4c73ded26b765f346cd Mon Sep 17 00:00:00 2001 From: Taimoor Zaeem Date: Tue, 9 Dec 2025 12:37:22 +0500 Subject: [PATCH] fix: misleading logs on unsupported postgresql versions Postgrest fails on unsupported pg versions. However before killing the thread, it continues to print a few more log messages which were misleading. This commit fixes this by making sure that the no log message should be printed after the unsupported pg version observation and kill the thread immediately. Signed-off-by: Taimoor Zaeem (cherry picked from commit 0fa2f569a788eafc2d4ca41b2183e8d3cf5c023c) --- CHANGELOG.md | 4 ++++ src/PostgREST/AppState.hs | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5ed5f25..aa9363bdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. From versio ## Unreleased +### Fixed + +- Fix misleading logs on unsupported PostgreSQL versions by @taimoorzaeem in #4519 + ## [14.1] - 2025-11-05 ## Fixed diff --git a/src/PostgREST/AppState.hs b/src/PostgREST/AppState.hs index a2ac5862a..f231a4e9a 100644 --- a/src/PostgREST/AppState.hs +++ b/src/PostgREST/AppState.hs @@ -382,14 +382,16 @@ retryingSchemaCacheLoad appState@AppState{stateObserver=observer, stateMainThrea observer ExitDBNoRecoveryObs killThread mainThreadId return Nothing - Right actualPgVersion -> do - when (actualPgVersion < minimumPgVersion) $ do + Right actualPgVersion -> + if actualPgVersion < minimumPgVersion then do observer $ ExitUnsupportedPgVersion actualPgVersion minimumPgVersion killThread mainThreadId - observer $ DBConnectedObs $ pgvFullName actualPgVersion - observer $ PoolInit configDbPoolSize - putPgVersion appState actualPgVersion - return $ Just actualPgVersion + return Nothing + else do + observer $ DBConnectedObs $ pgvFullName actualPgVersion + observer $ PoolInit configDbPoolSize + putPgVersion appState actualPgVersion + return $ Just actualPgVersion qInDbConfig :: IO () qInDbConfig = do