diff --git a/pg-transact.cabal b/pg-transact.cabal
--- a/pg-transact.cabal
+++ b/pg-transact.cabal
@@ -1,5 +1,5 @@
 name:                pg-transact
-version:             0.1.0.1
+version:             0.1.2.0
 synopsis: Another postgresql-simple transaction monad
 description: Another postgresql-simple transaction monad
 homepage:            https://github.com/jfischoff/pg-transact#readme
diff --git a/src/Database/PostgreSQL/Transact.hs b/src/Database/PostgreSQL/Transact.hs
--- a/src/Database/PostgreSQL/Transact.hs
+++ b/src/Database/PostgreSQL/Transact.hs
@@ -2,6 +2,7 @@
 module Database.PostgreSQL.Transact where
 import Control.Monad.Trans.Reader
 import Database.PostgreSQL.Simple as Simple
+import Database.PostgreSQL.Simple.Types as Simple
 import Database.PostgreSQL.Simple.Transaction
 import Control.Monad.IO.Class
 import Control.Monad.Trans.Class
@@ -10,6 +11,8 @@
 import Data.Int
 import Control.Monad
 import qualified Data.ByteString as BS
+import qualified Data.ByteString.Char8 as BSC
+import qualified Control.Monad.Fail as Fail
 
 newtype DBT m a = DBT { unDBT :: ReaderT Connection m a }
   deriving (MonadTrans, MonadThrow)
@@ -30,6 +33,9 @@
   return = lift . return
   DBT m >>= k = DBT $ m >>= unDBT . k
 
+instance Fail.MonadFail m => Fail.MonadFail (DBT m) where
+  fail = lift . Fail.fail
+
 isClass25 :: SqlError -> Bool
 isClass25 SqlError{..} = BS.take 2 sqlState == "25"
 
@@ -146,3 +152,42 @@
 -- Throws 'FormatError' if the query could not be formatted correctly.
 returning :: (ToRow q, FromRow r, MonadIO m) => Query -> [q] -> DBT m [r]
 returning q xs = getConnection >>= \conn -> liftIO $ Simple.returning conn q xs
+
+
+-- | Format a query string.
+--
+-- This function is exposed to help with debugging and logging. Do not
+-- use it to prepare queries for execution.
+--
+-- String parameters are escaped according to the character set in use
+-- on the 'Connection'.
+--
+-- Throws 'FormatError' if the query string could not be formatted
+-- correctly.
+formatQuery :: (ToRow q, MonadIO m) => Query -> q -> DBT m BS.ByteString
+formatQuery q xs = getConnection >>= \conn -> liftIO $ Simple.formatQuery conn q xs
+
+newtype TooManyRows = TooManyRows String
+  deriving(Show, Eq)
+
+instance Exception TooManyRows
+
+queryOne :: (ToRow a, FromRow b) => Query -> a -> DB (Maybe b)
+queryOne q x = do
+  rows <- Database.PostgreSQL.Transact.query q x
+  case rows of
+    []  -> return Nothing
+    [a] -> return $ Just a
+    _  -> do
+      let Simple.Query str = q
+      throwM $ TooManyRows $ BSC.unpack str
+
+queryOne_ :: FromRow b => Query -> DB (Maybe b)
+queryOne_ q = do
+  rows <- Database.PostgreSQL.Transact.query_ q
+  case rows of
+    []  -> return Nothing
+    [x] -> return $ Just x
+    _  -> do
+      let Simple.Query str = q
+      throwM $ TooManyRows $ BSC.unpack str
