diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,12 @@
 # Changelog for persistent
 
+## 2.14.5.1
+
+* [#1496](https://github.com/yesodweb/persistent/pull/1496)
+    * Fixes name shadowing error at the generated `keyFromRecordM` function.
+* [#1505](https://github.com/yesodweb/persistent/pull/1505)
+    * Fixes the comment line parsing rule so that accommodates paragraph breaks.
+
 ## 2.14.5.0
 
 * [#1469](https://github.com/yesodweb/persistent/pull/1469)
diff --git a/Database/Persist/PersistValue.hs b/Database/Persist/PersistValue.hs
--- a/Database/Persist/PersistValue.hs
+++ b/Database/Persist/PersistValue.hs
@@ -23,7 +23,7 @@
 import Numeric (readHex, showHex)
 import qualified Data.Text as Text
 import Data.Text (Text)
-import Data.ByteString (ByteString, foldl')
+import Data.ByteString as BS (ByteString, foldl')
 import Data.Time (Day, TimeOfDay, UTCTime)
 import Web.PathPieces (PathPiece(..))
 import qualified Data.Aeson as A
@@ -235,7 +235,7 @@
 
          -- taken from crypto-api
          bs2i :: ByteString -> Integer
-         bs2i bs = foldl' (\i b -> (i `shiftL` 8) + fromIntegral b) 0 bs
+         bs2i bs = BS.foldl' (\i b -> (i `shiftL` 8) + fromIntegral b) 0 bs
          {-# INLINE bs2i #-}
 
          -- showHex of n padded with leading zeros if necessary to fill d digits
diff --git a/Database/Persist/Quasi/Internal.hs b/Database/Persist/Quasi/Internal.hs
--- a/Database/Persist/Quasi/Internal.hs
+++ b/Database/Persist/Quasi/Internal.hs
@@ -53,8 +53,8 @@
 import Prelude hiding (lines)
 
 import Control.Applicative (Alternative((<|>)))
-import Data.Char (isDigit, isLower, isSpace, isUpper, toLower)
 import Control.Monad
+import Data.Char (isDigit, isLower, isSpace, isUpper, toLower)
 import Data.List (find, foldl')
 import Data.List.NonEmpty (NonEmpty(..))
 import qualified Data.List.NonEmpty as NEL
@@ -238,7 +238,7 @@
 tokenize :: Text -> [Token]
 tokenize t
     | T.null t = []
-    | Just txt <- T.stripPrefix "-- | " t = [DocComment txt]
+    | Just txt <- T.stripPrefix "-- |" t = [DocComment (T.stripStart txt)]
     | "--" `T.isPrefixOf` t = [] -- Comment until the end of the line.
     | "#" `T.isPrefixOf` t = [] -- Also comment to the end of the line, needed for a CPP bug (#110)
     | T.head t == '"' = quotes (T.tail t) id
diff --git a/Database/Persist/TH.hs b/Database/Persist/TH.hs
--- a/Database/Persist/TH.hs
+++ b/Database/Persist/TH.hs
@@ -141,6 +141,7 @@
 conp :: Name -> [Pat] -> Pat
 conp name pats = ConP name [] pats
 #else
+conp :: Name -> [Pat] -> Pat
 conp = ConP
 #endif
 
@@ -1994,18 +1995,20 @@
     [keyFromRecordM'] <-
         case unboundPrimarySpec entDef of
             NaturalKey ucd -> do
-                let
-                    keyCon =
-                        keyConName entDef
-                    keyFields' =
-                        fieldNameToRecordName mps entDef <$> unboundCompositeCols ucd
+                let keyFields' = fieldNameToRecordName mps entDef <$> unboundCompositeCols ucd
+                keyFieldNames' <- forM keyFields' $ \fieldName -> do
+                                         fieldVarName <- newName (nameBase fieldName)
+                                         return (fieldName, fieldVarName)
+
+                let keyCon = keyConName entDef
                     constr =
                         foldl'
                             AppE
                             (ConE keyCon)
-                            (VarE <$> keyFields')
+                            (VarE . snd <$> keyFieldNames')
                     keyFromRec = varP 'keyFromRecordM
-                    lam = LamE [RecP name [(n, VarP n) | n <- toList keyFields']] constr
+                    fieldPat = [(fieldName, VarP fieldVarName) | (fieldName, fieldVarName) <- toList keyFieldNames']
+                    lam = LamE [RecP name fieldPat ] constr
                 [d|
                     $(keyFromRec) = Just $(pure lam)
                     |]
diff --git a/persistent.cabal b/persistent.cabal
--- a/persistent.cabal
+++ b/persistent.cabal
@@ -1,5 +1,5 @@
 name:            persistent
-version:         2.14.5.0
+version:         2.14.5.1
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
diff --git a/test/Database/Persist/QuasiSpec.hs b/test/Database/Persist/QuasiSpec.hs
--- a/test/Database/Persist/QuasiSpec.hs
+++ b/test/Database/Persist/QuasiSpec.hs
@@ -236,6 +236,13 @@
                             [ DocComment "this is a comment"
                             ]
                         )
+            it "recognizes empty line" $ do
+                parseLine "-- |" `shouldBe`
+                    Just
+                        ( Line 0
+                            [ DocComment ""
+                            ]
+                        )
 
             it "works if comment is indented" $ do
                 parseLine "  -- | comment" `shouldBe`
diff --git a/test/Database/Persist/TH/CompositeKeyStyleSpec.hs b/test/Database/Persist/TH/CompositeKeyStyleSpec.hs
--- a/test/Database/Persist/TH/CompositeKeyStyleSpec.hs
+++ b/test/Database/Persist/TH/CompositeKeyStyleSpec.hs
@@ -10,6 +10,8 @@
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE UndecidableInstances #-}
 
+{-# OPTIONS_GHC -Wname-shadowing -Werror=name-shadowing #-}
+
 module Database.Persist.TH.CompositeKeyStyleSpec where
 
 import Data.Data (Data, constrFields, toConstr)
