diff --git a/Database/Persist/Postgresql.hs b/Database/Persist/Postgresql.hs
--- a/Database/Persist/Postgresql.hs
+++ b/Database/Persist/Postgresql.hs
@@ -159,7 +159,7 @@
                 ]
   in case entityPrimary ent of
        Just _pdef -> ISRManyKeys sql vals
-       Nothing -> ISRSingle (sql <> " RETURNING " <> escape (sqlIdName ent))
+       Nothing -> ISRSingle (sql <> " RETURNING " <> escape (fieldDB (entityId ent)))
 
 execute' :: PG.Connection -> PG.Query -> [PersistValue] -> IO Int64
 execute' conn query vals = PG.execute conn query (map P vals)
@@ -398,11 +398,11 @@
                 then do
                     let idtxt = case entityPrimary val of
                                   Just pdef -> T.concat [" PRIMARY KEY (", T.intercalate "," $ map (escape . fieldDB) $ compositeFields pdef, ")"]
-                                  Nothing   -> T.concat [escape $ sqlIdName val
+                                  Nothing   -> T.concat [escape $ fieldDB (entityId val)
                                         , " SERIAL PRIMARY KEY UNIQUE"]
                     let addTable = AddTable $ T.concat
                             -- Lower case e: see Database.Persist.Sql.Migration
-                            [ "CREATE TABLE "
+                            [ "CREATe TABLE " -- DO NOT FIX THE CAPITALIZATION!
                             , escape name
                             , "("
                             , idtxt
@@ -459,7 +459,7 @@
     stmt <- getter sqlv
     let vals =
             [ PersistText $ unDBName $ entityDB def
-            , PersistText $ unDBName $ sqlIdName def
+            , PersistText $ unDBName $ fieldDB (entityId def)
             ]
     cs <- with (stmtQuery stmt vals) ($$ helper)
     let sqlc = T.concat ["SELECT "
@@ -632,7 +632,7 @@
                 refDrop (Just (_, cname)) = [(name, DropReference cname)]
                 refAdd Nothing = []
                 refAdd (Just (tname, a)) = case find ((==tname) . entityDB) defs of
-                                                Just refdef -> [(tname, AddReference a [name] [sqlIdName refdef])]
+                                                Just refdef -> [(tname, AddReference a [name] [fieldDB (entityId refdef)])]
                                                 Nothing -> error $ "could not find the entityDef for reftable[" ++ show tname ++ "]"
                 modRef =
                     if fmap snd ref == fmap snd ref'
@@ -677,7 +677,7 @@
                             id_ = fromMaybe (error $ "Could not find ID of entity " ++ show reftable)
                                         $ do
                                           entDef <- find ((== reftable) . entityDB) allDefs
-                                          return (sqlIdName entDef)
+                                          return (fieldDB (entityId entDef))
 
 
 showColumn :: Column -> Text
diff --git a/persistent-postgresql.cabal b/persistent-postgresql.cabal
--- a/persistent-postgresql.cabal
+++ b/persistent-postgresql.cabal
@@ -1,5 +1,5 @@
 name:            persistent-postgresql
-version:         2.0.4
+version:         2.0.4.1
 license:         MIT
 license-file:    LICENSE
 author:          Felipe Lessa, Michael Snoyman <michael@snoyman.com>
