From a37d44ab6b2bac3f11498dfc28913af6d39f98d9 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 8 Mar 2024 16:02:09 +0100 Subject: [PATCH] Do not include SET ROLE and SELECT pg_backend_pid in the statistics --- src/Database/PostgreSQL/PQTypes/Internal/Connection.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs b/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs index 6176531..7c7b946 100644 --- a/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs +++ b/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs @@ -239,7 +239,13 @@ connect ConnectionSettings {..} = mask $ \unmask -> do (_, res) <- runQueryIO conn selectPid case F.toList $ mkQueryResult @(Identity Int32) selectPid noBackendPid res of [pid] -> withConnectionData conn fname $ \cd -> do - pure (cd {cdBackendPid = BackendPid $ fromIntegral pid}, ()) + pure + ( cd + { cdBackendPid = BackendPid $ fromIntegral pid + , cdStats = initialStats -- Statistics are for user queries. + } + , () + ) pids -> do let err = HPQTypesError $ "unexpected backend pid: " ++ show pids rethrowWithContext selectPid noBackendPid $ toException err