fix: not logging explain query for estimated count

Fixes https://github.com/PostgREST/postgrest/issues/4319
This commit is contained in:
steve-chavez
2025-09-15 17:07:12 -05:00
committed by Steve Chavez
parent a75ec75fff
commit 15e04903b1
5 changed files with 71 additions and 47 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ logWithZTime loggerState txt = do
logMainQ :: LoggerState -> MainQuery -> IO ()
logMainQ loggerState MainQuery{mqOpenAPI=(x, y, z),..} =
let snipts = renderSnippet <$> [mqMain, x, y, z]
let snipts = renderSnippet <$> [mqMain, x, y, z, fromMaybe mempty mqExplain]
-- Does not log SQL when it's empty (happens on OPTIONS requests and when the openapi queries are not generated)
logQ q = when (q /= mempty) $ logWithZTime loggerState $ showOnSingleLine '\n' $ T.decodeUtf8 q in
mapM_ logQ snipts