From 55b6bcd9e81aea4248adeb97bb058bf49846cff7 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 10 Jul 2025 12:32:44 +0200 Subject: [PATCH 1/6] chore(deps): update nixpkgs to haskell-updates (2025-07-07) This branch contains fixes to build TemplateHaskell with GHC 9.6+. --- flake.lock | 12 ++++++------ flake.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index e687ae5129..a000fe204e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1752006229, - "narHash": "sha256-BeuAPwNM2RBc5bvUTb0j4GRs2yBkDeRCw/8Y3v9Xesc=", - "owner": "nixos", + "lastModified": 1751899146, + "narHash": "sha256-XmyGMCVZEVvY/KbWoAX+4LqDfvpzUny83RUzGsX3CjI=", + "owner": "wolfgangwalther", "repo": "nixpkgs", - "rev": "c80edd02003fe3d8af527215a3ac069be9cfd47f", + "rev": "abd8015915201ea44889ee0f1286b47fb900577a", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-25.05-darwin", + "owner": "wolfgangwalther", + "ref": "haskell-static-template-haskell", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 61dd80f635..f8453e9461 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "REST API for any Postgres database"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-25.05-darwin"; + nixpkgs.url = "github:wolfgangwalther/nixpkgs/haskell-static-template-haskell"; }; nixConfig = { From 5911eb52be24899452828bdd532ac92485ae43f6 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 10 Jul 2025 12:27:39 +0200 Subject: [PATCH 2/6] nix: pin hsie at GHC 9.4 This needs more involved changes in the hsie source code, which can be deferred to later. --- default.nix | 4 +--- nix/hsie/default.nix | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 6d1245c4db..7a03645d11 100644 --- a/default.nix +++ b/default.nix @@ -104,9 +104,7 @@ rec { # Tooling for analyzing Haskell imports and exports. hsie = - pkgs.callPackage nix/hsie { - inherit (pkgs.haskell.packages."${compiler}") ghcWithPackages; - }; + pkgs.callPackage nix/hsie { }; ### Tools diff --git a/nix/hsie/default.nix b/nix/hsie/default.nix index 706c43848c..5b272051cc 100644 --- a/nix/hsie/default.nix +++ b/nix/hsie/default.nix @@ -1,4 +1,4 @@ -{ ghcWithPackages +{ haskell , runCommand }: let @@ -14,7 +14,7 @@ let ps.ghc-paths ps.optparse-applicative ]; - ghc = ghcWithPackages modules; + ghc = haskell.packages.ghc94.ghcWithPackages modules; hsie = runCommand "haskellimports" { inherit name src; } '' From df60948941fbdd56389d97658efc86a62a4db466 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 10 Jul 2025 12:30:02 +0200 Subject: [PATCH 3/6] nix: build with GHC 9.6.7 --- default.nix | 2 +- postgrest.cabal | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 7a03645d11..e46900415a 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { system ? builtins.currentSystem -, compiler ? "ghc948" +, compiler ? "ghc967" , # Commit of the Nixpkgs repository that we want to use. # It defaults to reading the inputs from flake.lock, which serves diff --git a/postgrest.cabal b/postgrest.cabal index fa28807b4e..e6d1e95051 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -16,11 +16,10 @@ extra-source-files: CHANGELOG.md cabal-version: >= 1.10 tested-with: - -- nix - GHC == 9.4.8 -- cabal on Ubuntu + -- nix -- stack on FreeBSD, MacOS, Ubuntu, Windows - , GHC == 9.6.7 + GHC == 9.6.7 -- cabal on Ubuntu , GHC == 9.8.4 From 8bd8344682d6ffa1cf31da9e314789a1a8ce1141 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 10 Jul 2025 20:17:46 +0200 Subject: [PATCH 4/6] chore: release static executable for aarch64-linux Also makes the aarch64 variant of the docker image consist of a single static executable, similar to the x86_64 variant. --- .github/workflows/build.yaml | 31 +++++++++++---------- .github/workflows/release.yaml | 50 +++++++++++++++------------------- 2 files changed, 38 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38298badda..1f44b5efe9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,8 +30,18 @@ concurrency: jobs: static: - name: Nix - Linux x86-64 static - runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - name: Linux aarch64 + runs-on: ubuntu-24.04-arm + artifact: aarch64 + - name: Linux x86-64 + runs-on: ubuntu-24.04 + artifact: x86-64 + name: Nix - ${{ matrix.name }} static + runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup Nix Environment @@ -44,17 +54,17 @@ jobs: - name: Save built executable as artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: postgrest-linux-static-x86-64 + name: postgrest-linux-static-${{ matrix.artifact }} path: result/bin/postgrest if-no-files-found: error - name: Build Docker image - run: nix-build -A docker.image --out-link postgrest-docker.tar.gz + run: nix-build -A docker.image --out-link postgrest-docker-${{ matrix.artifact }}.tar.gz - name: Save built Docker image as artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: postgrest-docker-x86-64 - path: postgrest-docker.tar.gz + name: postgrest-docker-${{ matrix.artifact }} + path: postgrest-docker-${{ matrix.artifact }}.tar.gz if-no-files-found: error @@ -87,15 +97,6 @@ jobs: fail-fast: false matrix: include: - - name: Linux aarch64 - runs-on: ubuntu-24.04-arm - cache: | - ~/.stack/pantry - ~/.stack/snapshots - ~/.stack/stack.sqlite3 - artifact: postgrest-ubuntu-aarch64 - deps: sudo apt-get update && sudo apt-get install libpq-dev - - name: MacOS aarch64 runs-on: macos-14 cache: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d2cdd80427..001f661046 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -75,6 +75,9 @@ jobs: mkdir -p release-bundle + tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-linux-static-aarch64.tar.xz" \ + -C artifacts/postgrest-linux-static-aarch64 postgrest + tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-linux-static-x86-64.tar.xz" \ -C artifacts/postgrest-linux-static-x86-64 postgrest @@ -87,9 +90,6 @@ jobs: tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-freebsd-x86-64.tar.xz" \ -C artifacts/postgrest-freebsd-x86-64 postgrest - tar cJvf "release-bundle/postgrest-${GITHUB_REF_NAME}-ubuntu-aarch64.tar.xz" \ - -C artifacts/postgrest-ubuntu-aarch64 postgrest - zip --junk-paths "release-bundle/postgrest-${GITHUB_REF_NAME}-windows-x86-64.zip" \ artifacts/postgrest-windows-x86-64/postgrest.exe @@ -139,49 +139,43 @@ jobs: DOCKER_REPO: ${{ vars.DOCKER_REPO }} steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Download x86-64 Docker image + - name: Download aarch64 Docker image uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: - name: postgrest-docker-x86-64 - - name: Download aarch64 binary + name: postgrest-docker-aarch64 + - name: Download x86-64 Docker image uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: - name: postgrest-ubuntu-aarch64 + name: postgrest-docker-x86-64 - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 with: username: ${{ vars.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - - name: Build aarch64 Docker image - run: | - # This only pushes the image via digest, not a tag. This will not appear - # in the image list on Docker Hub, yet. It will be later added to the main - # tag's manifest. - docker buildx build \ - -t "$DOCKER_REPO/postgrest" \ - --platform linux/arm64 \ - --output push-by-digest=true,type=image,push=true \ - --metadata-file metadata.json \ - . - echo "SHA256_ARM=$(jq -r '."containerimage.digest"' metadata.json)" >> "$GITHUB_ENV" - name: Publish images on Docker Hub run: | - docker load -i postgrest-docker.tar.gz + docker load -i postgrest-docker-aarch64.tar.gz + docker tag postgrest:latest "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" + docker push "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" + SHA256_ARM64=$(docker inspect postgrest:latest | jq -r '.[0].Id') + docker load -i postgrest-docker-x86-64.tar.gz docker tag postgrest:latest "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" docker push "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" - docker buildx imagetools create --append \ - -t "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" \ - "$DOCKER_REPO/postgrest@$SHA256_ARM" + SHA256_AMD64=$(docker inspect postgrest:latest | jq -r '.[0].Id') + + docker manifest create "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" \ + "$DOCKER_REPO/postgrest@$SHA256_ARM64" \ + "$DOCKER_REPO/postgrest@$SHA256_AMD64" + docker manifest push "$DOCKER_REPO/postgrest:${GITHUB_REF_NAME}" # Only tag 'latest' for full releases if [ "${GITHUB_REF_NAME}" != "devel" ]; then echo "Pushing to 'latest' tag for full release of ${GITHUB_REF_NAME} ..." - docker tag postgrest:latest "$DOCKER_REPO"/postgrest:latest - docker push "$DOCKER_REPO"/postgrest:latest - docker buildx imagetools create --append \ - -t "$DOCKER_REPO/postgrest:latest" \ - "$DOCKER_REPO/postgrest@$SHA256_ARM" + docker manifest create "$DOCKER_REPO/postgrest:latest" \ + "$DOCKER_REPO/postgrest@$SHA256_ARM64" \ + "$DOCKER_REPO/postgrest@$SHA256_AMD64" + docker manifest push "$DOCKER_REPO/postgrest:latest" else echo "Skipping push to 'latest' tag for pre-release..." fi From 5f6f50d3b76cdaf982eb42361ed39f5b45a0d5bb Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 11 Jul 2025 18:56:04 +0200 Subject: [PATCH 5/6] chore: fix stack.yml's nix integration once more We don't need an impure environment anymore, because we can't run the test suite via stack anyway. --- stack.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stack.yaml b/stack.yaml index 20de8d453e..29b4c74031 100644 --- a/stack.yaml +++ b/stack.yaml @@ -3,10 +3,9 @@ resolver: lts-22.44 # 2025-05-02, GHC 9.6.7 nix: packages: - libpq + - libpq.pg_config - pkg-config - zlib - # disable pure by default so that the test environment can be passed - pure: false extra-deps: - fuzzyset-0.2.4 From 612dfec6a9666d04cad0be5ac1d8733e48a250a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 10 Jul 2025 14:29:32 +0200 Subject: [PATCH 6/6] chore(deps): update hasql to 1.8.1.4 --- nix/overlays/haskell-packages.nix | 11 +----- postgrest.cabal | 10 ++--- src/PostgREST/AppState.hs | 43 +++++++++++--------- src/PostgREST/Error.hs | 11 +++++- src/PostgREST/Metrics.hs | 2 +- src/PostgREST/Observation.hs | 6 ++- stack.yaml | 11 +++++- stack.yaml.lock | 65 +++++++++++++++++++++++++++---- 8 files changed, 112 insertions(+), 47 deletions(-) diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index 1e0feefd56..cf7bfb2998 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -2,7 +2,7 @@ self: super: let - inherit (self.haskell) lib; + # inherit (self.haskell) lib; overrides = _: prev: @@ -49,15 +49,6 @@ let # Before upgrading fuzzyset to 0.3, check: https://github.com/PostgREST/postgrest/issues/3329 # jailbreak, because hspec limit for tests fuzzyset = prev.fuzzyset_0_2_4; - - # Downgrade hasql and related packages while we are still on GHC 9.4 for the static build. - hasql = lib.dontCheck (lib.doJailbreak prev.hasql_1_6_4_4); - hasql-dynamic-statements = lib.dontCheck prev.hasql-dynamic-statements_0_3_1_5; - hasql-implicits = lib.dontCheck prev.hasql-implicits_0_1_1_3; - hasql-notifications = lib.dontCheck prev.hasql-notifications_0_2_2_2; - hasql-pool = lib.dontCheck prev.hasql-pool_1_0_1; - hasql-transaction = lib.dontCheck prev.hasql-transaction_1_1_0_1; - postgresql-binary = lib.dontCheck (lib.doJailbreak prev.postgresql-binary_0_13_1_3); }; in { diff --git a/postgrest.cabal b/postgrest.cabal index e6d1e95051..582c5a039e 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -110,10 +110,10 @@ library , either >= 4.4.1 && < 5.1 , extra >= 1.7.0 && < 2.0 , fuzzyset >= 0.2.4 && < 0.3 - , hasql >= 1.6.1.1 && < 1.7 + , hasql >= 1.7 && < 1.9 , hasql-dynamic-statements >= 0.3.1 && < 0.4 - , hasql-notifications >= 0.2.2.2 && < 0.2.3 - , hasql-pool >= 1.0.1 && < 1.1 + , hasql-notifications >= 0.2.2.0 && < 0.3 + , hasql-pool >= 1.1 && < 1.3 , hasql-transaction >= 1.0.1 && < 1.2 , heredoc >= 0.2 && < 0.3 , http-types >= 0.12.2 && < 0.13 @@ -128,8 +128,6 @@ library , network-uri >= 2.6.1 && < 2.8 , optparse-applicative >= 0.13 && < 0.19 , parsec >= 3.1.11 && < 3.2 - -- Technically unused, can be removed after updating to hasql >= 1.7 - , postgresql-libpq >= 0.10 , prometheus-client >= 1.1.1 && < 1.2.0 , protolude >= 0.3.1 && < 0.4 , regex-tdfa >= 1.2.2 && < 1.4 @@ -265,7 +263,7 @@ test-suite spec , bytestring >= 0.10.8 && < 0.13 , case-insensitive >= 1.2 && < 1.3 , containers >= 0.5.7 && < 0.7 - , hasql-pool >= 1.0.1 && < 1.1 + , hasql-pool >= 1.0.1 && < 1.3 , hasql-transaction >= 1.0.1 && < 1.2 , heredoc >= 0.2 && < 0.3 , hspec >= 2.3 && < 2.12 diff --git a/src/PostgREST/AppState.hs b/src/PostgREST/AppState.hs index 9a65871cc6..7c80e645c1 100644 --- a/src/PostgREST/AppState.hs +++ b/src/PostgREST/AppState.hs @@ -214,21 +214,34 @@ initPool AppConfig{..} observer = do -- | Run an action with a database connection. usePool :: AppState -> SQL.Session a -> IO (Either SQL.UsageError a) usePool AppState{stateObserver=observer, stateMainThreadId=mainThreadId, ..} sess = do - observer PoolRequest + observer PoolRequest - res <- SQL.use statePool sess + res <- SQL.use statePool sess - observer PoolRequestFullfilled + observer PoolRequestFullfilled - whenLeft res (\case - SQL.AcquisitionTimeoutUsageError -> - observer $ PoolAcqTimeoutObs SQL.AcquisitionTimeoutUsageError - err@(SQL.ConnectionUsageError e) -> - let failureMessage = BS.unpack $ fromMaybe mempty e in - when (("FATAL: password authentication failed" `isInfixOf` failureMessage) || ("no password supplied" `isInfixOf` failureMessage)) $ do - observer $ ExitDBFatalError ServerAuthError err - killThread mainThreadId - err@(SQL.SessionUsageError (SQL.QueryError tpl _ (SQL.ResultError resultErr))) -> do + whenLeft res (\case + SQL.AcquisitionTimeoutUsageError -> + observer $ PoolAcqTimeoutObs SQL.AcquisitionTimeoutUsageError + err@(SQL.ConnectionUsageError e) -> + let failureMessage = BS.unpack $ fromMaybe mempty e in + when (("FATAL: password authentication failed" `isInfixOf` failureMessage) || ("no password supplied" `isInfixOf` failureMessage)) $ do + observer $ ExitDBFatalError ServerAuthError err + killThread mainThreadId + err@(SQL.SessionUsageError (SQL.QueryError tpl _ (SQL.ResultError resultErr))) -> + handleResultError err tpl resultErr + err@(SQL.SessionUsageError (SQL.PipelineError (SQL.ResultError resultErr))) -> + -- Passing the empty template will not work for schema cache queries, see TODO further below. + handleResultError err mempty resultErr + err@(SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ClientError _))) -> + -- An error on the client-side, usually indicates problems with connection + observer $ QueryErrorCodeHighObs err + SQL.SessionUsageError (SQL.PipelineError (SQL.ClientError _)) -> pure () + ) + + return res + where + handleResultError err tpl resultErr = do case resultErr of SQL.UnexpectedResult{} -> do observer $ ExitDBFatalError ServerPgrstBug err @@ -261,12 +274,6 @@ usePool AppState{stateObserver=observer, stateMainThreadId=mainThreadId, ..} ses SQL.ServerError{} -> when (Error.status (Error.PgError False err) >= HTTP.status500) $ observer $ QueryErrorCodeHighObs err - err@(SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ClientError _))) -> - -- An error on the client-side, usually indicates problems wth connection - observer $ QueryErrorCodeHighObs err - ) - - return res -- | Flush the connection pool so that any future use of the pool will -- use connections freshly established after this call. diff --git a/src/PostgREST/Error.hs b/src/PostgREST/Error.hs index 39217610cf..4649d094e1 100644 --- a/src/PostgREST/Error.hs +++ b/src/PostgREST/Error.hs @@ -526,18 +526,22 @@ instance JSON.ToJSON SQL.UsageError where instance ErrorBody SQL.UsageError where code (SQL.ConnectionUsageError _) = "PGRST000" + code (SQL.SessionUsageError (SQL.PipelineError e)) = code e code (SQL.SessionUsageError (SQL.QueryError _ _ e)) = code e code SQL.AcquisitionTimeoutUsageError = "PGRST003" message (SQL.ConnectionUsageError _) = "Database connection error. Retrying the connection." + message (SQL.SessionUsageError (SQL.PipelineError e)) = message e message (SQL.SessionUsageError (SQL.QueryError _ _ e)) = message e message SQL.AcquisitionTimeoutUsageError = "Timed out acquiring connection from connection pool." details (SQL.ConnectionUsageError e) = JSON.String . T.decodeUtf8 <$> e + details (SQL.SessionUsageError (SQL.PipelineError e)) = details e details (SQL.SessionUsageError (SQL.QueryError _ _ e)) = details e details SQL.AcquisitionTimeoutUsageError = Nothing hint (SQL.ConnectionUsageError _) = Nothing + hint (SQL.SessionUsageError (SQL.PipelineError e)) = hint e hint (SQL.SessionUsageError (SQL.QueryError _ _ e)) = hint e hint SQL.AcquisitionTimeoutUsageError = Nothing @@ -586,8 +590,13 @@ instance ErrorBody SQL.CommandError where pgErrorStatus :: Bool -> SQL.UsageError -> HTTP.Status pgErrorStatus _ (SQL.ConnectionUsageError _) = HTTP.status503 pgErrorStatus _ SQL.AcquisitionTimeoutUsageError = HTTP.status504 +pgErrorStatus _ (SQL.SessionUsageError (SQL.PipelineError (SQL.ClientError _))) = HTTP.status503 pgErrorStatus _ (SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ClientError _))) = HTTP.status503 -pgErrorStatus authed (SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ResultError rError))) = +pgErrorStatus authed (SQL.SessionUsageError (SQL.PipelineError (SQL.ResultError rError))) = mapSQLtoHTTP authed rError +pgErrorStatus authed (SQL.SessionUsageError (SQL.QueryError _ _ (SQL.ResultError rError))) = mapSQLtoHTTP authed rError + +mapSQLtoHTTP :: Bool -> SQL.ResultError -> HTTP.Status +mapSQLtoHTTP authed rError = case rError of (SQL.ServerError c m d _ _) -> case BS.unpack c of diff --git a/src/PostgREST/Metrics.hs b/src/PostgREST/Metrics.hs index 7a39557751..26ca017408 100644 --- a/src/PostgREST/Metrics.hs +++ b/src/PostgREST/Metrics.hs @@ -53,7 +53,7 @@ observationMetrics MetricsState{..} obs = case obs of (PoolAcqTimeoutObs _) -> do incCounter poolTimeouts (HasqlPoolObs (SQL.ConnectionObservation _ status)) -> case status of - SQL.ReadyForUseConnectionStatus -> do + SQL.ReadyForUseConnectionStatus _ -> do incGauge poolAvailable SQL.InUseConnectionStatus -> do decGauge poolAvailable diff --git a/src/PostgREST/Observation.hs b/src/PostgREST/Observation.hs index 296de0f486..52cd36517f 100644 --- a/src/PostgREST/Observation.hs +++ b/src/PostgREST/Observation.hs @@ -141,13 +141,17 @@ observationMessage = \case "Connection " <> show uuid <> ( case status of SQL.ConnectingConnectionStatus -> " is being established" - SQL.ReadyForUseConnectionStatus -> " is available" + SQL.ReadyForUseConnectionStatus reason -> " is available due to " <> case reason of + SQL.EstablishedConnectionReadyForUseReason -> "connection establishment" + SQL.SessionFailedConnectionReadyForUseReason _ -> "session failure" + SQL.SessionSucceededConnectionReadyForUseReason -> "session success" SQL.InUseConnectionStatus -> " is used" SQL.TerminatedConnectionStatus reason -> " is terminated due to " <> case reason of SQL.AgingConnectionTerminationReason -> "max lifetime" SQL.IdlenessConnectionTerminationReason -> "max idletime" SQL.ReleaseConnectionTerminationReason -> "release" SQL.NetworkErrorConnectionTerminationReason _ -> "network error" -- usage error is already logged, no need to repeat the same message. + SQL.InitializationErrorTerminationReason _ -> "init failure" ) PoolRequest -> "Trying to borrow a connection from pool" diff --git a/stack.yaml b/stack.yaml index 29b4c74031..7d99ca602a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -9,6 +9,13 @@ nix: extra-deps: - fuzzyset-0.2.4 - - hasql-pool-1.0.1 + - hasql-1.8.1.4 + - hasql-dynamic-statements-0.3.1.8 + - hasql-implicits-0.2.0.1 + - hasql-notifications-0.2.3.2 + - hasql-pool-1.2.0.3 + - hasql-transaction-1.1.1.2 - jose-jwt-0.10.0 - - postgresql-libpq-0.10.1.0 + - postgresql-binary-0.14.0.1 + - postgresql-libpq-0.11.0.0 + - postgresql-libpq-configure-0.11 diff --git a/stack.yaml.lock b/stack.yaml.lock index 32956204fc..fce7ce1329 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -12,12 +12,47 @@ packages: original: hackage: fuzzyset-0.2.4 - completed: - hackage: hasql-pool-1.0.1@sha256:3cfb4c7153a6c536ac7e126c17723e6d26ee03794954deed2d72bcc826d05a40,2302 + hackage: hasql-1.8.1.4@sha256:9f8b036b1485994da1fc804cead2bdf0eccebcb31fe109e8c0aaa49dea6ad72b,5696 pantry-tree: - sha256: d98e1269bdd60989b0eb0b84e1d5357eaa9f92821439d9f206663b7251ee95b2 - size: 799 + sha256: a429280972f8c8f4624b2e84ea550a05e1d9a9cd7d8b2cdbcf27253feb6f98a1 + size: 3438 original: - hackage: hasql-pool-1.0.1 + hackage: hasql-1.8.1.4 +- completed: + hackage: hasql-dynamic-statements-0.3.1.8@sha256:7665dae003849430980b835f864c571f1a7aa8c8a2640876c94576955c98444e,2537 + pantry-tree: + sha256: 68c29c16f70bf1450926c8e511a54755cebd25002c06d0664202b8913b523c15 + size: 595 + original: + hackage: hasql-dynamic-statements-0.3.1.8 +- completed: + hackage: hasql-implicits-0.2.0.1@sha256:63ca855a4b857e762d48757f6a9562a2cb9fd895c3d38c941260768278c4923c,1336 + pantry-tree: + sha256: cb9e593c1579dd8de430cb587643896c39eff09e6c45a1432324e9d6af2ca876 + size: 264 + original: + hackage: hasql-implicits-0.2.0.1 +- completed: + hackage: hasql-notifications-0.2.3.2@sha256:547c1c677227b3063042f3af4d150dd224c1219545e936428da6d6b05e56c5fb,1998 + pantry-tree: + sha256: 6e0427de378fe97da347ec977b0353001940e8f8ff772a310eb2acac95ef7b12 + size: 452 + original: + hackage: hasql-notifications-0.2.3.2 +- completed: + hackage: hasql-pool-1.2.0.3@sha256:27cfef3f4921c9cdaf4cae095f802c9977976a434842792d2b073537681b16c8,2389 + pantry-tree: + sha256: f380573da2665b994fa9fb31e55c272f3757598f57f850fdb31d1b7fbe184a5e + size: 982 + original: + hackage: hasql-pool-1.2.0.3 +- completed: + hackage: hasql-transaction-1.1.1.2@sha256:be4fb0e49da04f55c9bfbd5828f7025f1cf3165340ecf79b57ec286f4bde2368,2592 + pantry-tree: + sha256: 41a8a96841e612787f2a744c49a57b5d5f4aa3fbaec3efe5ed1d37441f54c3b5 + size: 1027 + original: + hackage: hasql-transaction-1.1.1.2 - completed: hackage: jose-jwt-0.10.0@sha256:6ed175a01c721e317ceea15eb251a81de145c03711a977517935633a5cdec1d4,3546 pantry-tree: @@ -26,12 +61,26 @@ packages: original: hackage: jose-jwt-0.10.0 - completed: - hackage: postgresql-libpq-0.10.1.0@sha256:6b580c9d5068e78eecc13e655b2885c8e79cdacfca513c5d1e5a6b9dc61d9758,3166 + hackage: postgresql-binary-0.14.0.1@sha256:06366fd82deda89f9237b885e9493eafe0b9903d05c19761288b048dcc9a99ee,4027 + pantry-tree: + sha256: ca58c715b5e5ad2abbfc1d87e3a620f27b93007591168acd2e60617880be35fa + size: 1661 + original: + hackage: postgresql-binary-0.14.0.1 +- completed: + hackage: postgresql-libpq-0.11.0.0@sha256:ca7facdf755f7ad3950e75eee4a388f52179b027ca983be362c400ab0a37a4c4,2702 + pantry-tree: + sha256: d401e0dd176fcbb8badb3ea9fd57614bb70c1a486cbe202c271a911f91d1556c + size: 1048 + original: + hackage: postgresql-libpq-0.11.0.0 +- completed: + hackage: postgresql-libpq-configure-0.11@sha256:019c5d83da0b4dc0b4487e0e868f2eed5efa25e0688f5cfc2ba8191a80e527aa,1309 pantry-tree: - sha256: ae81e7628a8f3d1ef33ace71fa0845c073c003ca7f1150cc9d9ba1e55fc84236 - size: 1096 + sha256: 04a70f52cfacce71901efb1eafe3ae3103d133c1c4ee89ba7a51877c67503041 + size: 353 original: - hackage: postgresql-libpq-0.10.1.0 + hackage: postgresql-libpq-configure-0.11 snapshots: - completed: sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9