diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
 # Changelog
 
+## [0.5.3.1] - 2026-11-29
+
+### Fixed
+
+* A test that runs out of time no longer leaves its database behind. Its
+  database was created and dropped while the test could be interrupted, and
+  the server goes on to create a database whose creation is interrupted,
+  which nothing then dropped. Dropping the template's user at the end of the
+  suite then failed, because that user owned the database, and so did the
+  suite.
+
 ## [0.5.3.0] - 2026-11-13
 
 ### Added
diff --git a/src/Test/Syd/Persistent/Postgresql.hs b/src/Test/Syd/Persistent/Postgresql.hs
--- a/src/Test/Syd/Persistent/Postgresql.hs
+++ b/src/Test/Syd/Persistent/Postgresql.hs
@@ -688,7 +688,12 @@
                 )
                 ()
             pure ()
-     in SetupFunc $ bracket createDB deleteDB
+     in -- Uninterruptible, because a test that runs out of time is
+        -- interrupted, and a database that is created or dropped while it is
+        -- interrupted is left behind.
+        -- The server goes on to create it, but nothing drops it, and then
+        -- dropping its owner fails at the end of the suite.
+        SetupFunc $ bracket (uninterruptibleMask_ createDB) (uninterruptibleMask_ . deleteDB)
 
 withAdminConn :: Temp.DB -> (PostgreSQL.Connection -> IO a) -> IO a
 withAdminConn db =
diff --git a/sydtest-persistent-postgresql.cabal b/sydtest-persistent-postgresql.cabal
--- a/sydtest-persistent-postgresql.cabal
+++ b/sydtest-persistent-postgresql.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           sydtest-persistent-postgresql
-version:        0.5.3.0
+version:        0.5.3.1
 synopsis:       An persistent-postgresql companion library for sydtest
 category:       Testing
 homepage:       https://github.com/NorfairKing/sydtest#readme
diff --git a/test/Test/Syd/Persistent/PostgresqlSpec.hs b/test/Test/Syd/Persistent/PostgresqlSpec.hs
--- a/test/Test/Syd/Persistent/PostgresqlSpec.hs
+++ b/test/Test/Syd/Persistent/PostgresqlSpec.hs
@@ -1,7 +1,12 @@
+{-# LANGUAGE NumericUnderscores #-}
+{-# LANGUAGE OverloadedStrings #-}
+
 module Test.Syd.Persistent.PostgresqlSpec (spec) where
 
+import Control.Monad
 import Database.Persist
 import Database.Persist.Sql
+import System.Timeout (timeout)
 import Test.Syd
 import Test.Syd.Persistent.Example
 import Test.Syd.Persistent.Postgresql
@@ -26,3 +31,18 @@
           runPostgresqlTest pool $ do
             mp <- get (toSqlKey 0)
             liftIO $ mp `shouldBe` (Nothing :: Maybe Person)
+  describe "connectionPoolSetupFunc" $
+    persistPostgresqlAdminSpec migrateExample $
+      -- A test that runs out of time is cancelled with an asynchronous
+      -- exception, which can arrive while its database is being created.
+      -- A database left behind is owned by the template's user, so dropping
+      -- that user at the end of the suite fails.
+      itWithOuter "leaves no database behind when it is cancelled while it is being set up" $ \templateDB -> do
+        forM_ [0, 500 .. 100_000] $ \delay ->
+          timeout delay $ unSetupFunc (connectionPoolSetupFunc templateDB) (\_ -> pure ())
+        unSetupFunc (connectionPoolSetupFunc templateDB) $ \pool -> do
+          databases <-
+            runSqlPool
+              (rawSql "SELECT datname FROM pg_database WHERE datname LIKE 'test_db_%'" [])
+              pool
+          length (databases :: [Single String]) `shouldBe` 1
