diff --git a/Database/Persist/Sql/Class.hs b/Database/Persist/Sql/Class.hs
--- a/Database/Persist/Sql/Class.hs
+++ b/Database/Persist/Sql/Class.hs
@@ -10,7 +10,6 @@
 module Database.Persist.Sql.Class
     ( RawSql (..)
     , PersistFieldSql (..)
-    , defaultIdName, sqlIdName
     , IsSqlKey (..)
     ) where
 
@@ -39,15 +38,6 @@
 import Data.Bits (bitSize)
 import qualified Data.Vector as V
 
-defaultIdName :: Text
-defaultIdName = "id"
-
-sqlIdName :: EntityDef -> DBName
-sqlIdName ent =
-    if primaryName /= (DBName "") then primaryName else DBName defaultIdName
-  where
-    primaryName = fieldDB (entityId ent)
-
 -- | Class for data types that may be retrived from a 'rawSql'
 -- query.
 class RawSql a where
@@ -74,7 +64,7 @@
           process ed = (:[]) $
                        intercalate ", " $
                        map ((name ed <>) . escape) $
-                       (sqlIdName ed :) $
+                       (fieldDB (entityId ed) :) $
                        map fieldDB $
                        entityFields ed
           name ed = escape (entityDB ed) <> "."
diff --git a/Database/Persist/Sql/Orphan/PersistQuery.hs b/Database/Persist/Sql/Orphan/PersistQuery.hs
--- a/Database/Persist/Sql/Orphan/PersistQuery.hs
+++ b/Database/Persist/Sql/Orphan/PersistQuery.hs
@@ -11,7 +11,7 @@
 import Database.Persist hiding (updateField)
 import Database.Persist.Sql.Types
 import Database.Persist.Sql.Raw
-import Database.Persist.Sql.Orphan.PersistStore (defaultIdName, sqlIdName, withRawQuery)
+import Database.Persist.Sql.Orphan.PersistStore (withRawQuery)
 import qualified Data.Text as T
 import Data.Text (Text)
 import Data.Monoid (Monoid (..), (<>))
@@ -100,7 +100,7 @@
                 [] -> ""
                 ords -> " ORDER BY " <> T.intercalate "," ords
         cols conn = T.intercalate ","
-                  $ (if composite then [] else [connEscapeName conn $ sqlIdName t])
+                  $ (if composite then [] else [connEscapeName conn $ fieldDB (entityId t)])
                   <> map (connEscapeName conn . fieldDB) (entityFields t)
         sql conn = connLimitOffset conn (limit,offset) (not (null orders)) $ mconcat
             [ "SELECT "
@@ -119,7 +119,7 @@
         t = entityDef $ dummyFromFilts filts
         cols conn = case entityPrimary t of 
                      Just pdef -> T.intercalate "," $ map (connEscapeName conn . fieldDB) $ compositeFields pdef
-                     Nothing   -> connEscapeName conn $ sqlIdName t
+                     Nothing   -> connEscapeName conn $ fieldDB (entityId t)
                       
         wher conn = if null filts
                     then ""
@@ -221,11 +221,7 @@
     updateField _ = error "BackendUpdate not implemented"
 
 fieldName ::  forall record typ.  (PersistEntity record, PersistEntityBackend record ~ Connection) => EntityField record typ -> DBName
-fieldName f | isIdField f && dbName == DBName "" = DBName defaultIdName
-            | otherwise = dbName
-  where
-    dbName = fieldDB fd
-    fd = persistFieldDef f
+fieldName f = fieldDB $ persistFieldDef f
 
 isIdField ::  forall record typ.  (PersistEntity record) => EntityField record typ -> Bool
 isIdField f = fieldHaskell (persistFieldDef f) == HaskellName "Id"
diff --git a/Database/Persist/Sql/Orphan/PersistStore.hs b/Database/Persist/Sql/Orphan/PersistStore.hs
--- a/Database/Persist/Sql/Orphan/PersistStore.hs
+++ b/Database/Persist/Sql/Orphan/PersistStore.hs
@@ -3,7 +3,7 @@
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
-module Database.Persist.Sql.Orphan.PersistStore (defaultIdName, sqlIdName, withRawQuery, BackendKey(..)) where
+module Database.Persist.Sql.Orphan.PersistStore (withRawQuery, BackendKey(..)) where
 
 import Database.Persist
 import Database.Persist.Sql.Types
@@ -22,7 +22,7 @@
 import Data.Acquire (with)
 import Data.Int (Int64)
 import Web.PathPieces (PathPiece)
-import Database.Persist.Sql.Class (PersistFieldSql, defaultIdName, sqlIdName)
+import Database.Persist.Sql.Class (PersistFieldSql)
 import qualified Data.Aeson as A
 import Control.Exception.Lifted (throwIO)
 
@@ -54,7 +54,7 @@
         let go' (x, pu) = go'' (connEscapeName conn x) pu
         let wher = case entityPrimary t of
                 Just pdef -> T.intercalate " AND " $ map (\fld -> connEscapeName conn (fieldDB fld) <> "=? ") $ compositeFields pdef
-                Nothing   -> connEscapeName conn (sqlIdName t) <> "=?"
+                Nothing   -> connEscapeName conn (fieldDB (entityId t)) <> "=?"
         let sql = T.concat
                 [ "UPDATE "
                 , connEscapeName conn $ entityDB t
@@ -157,7 +157,7 @@
                 , " SET "
                 , T.intercalate "," (map (go conn . fieldDB) $ entityFields t)
                 , " WHERE "
-                , connEscapeName conn $ sqlIdName t
+                , connEscapeName conn $ fieldDB (entityId t)
                 , "=?"
                 ]
             vals = map toPersistValue (toPersistFields val) `mappend` keyToValues k
@@ -182,7 +182,7 @@
             noColumns = null $ entityFields t
         let wher = case entityPrimary t of
                      Just pdef -> T.intercalate " AND " $ map (\fld -> connEscapeName conn (fieldDB fld) <> "=? ") $ compositeFields pdef
-                     Nothing   -> connEscapeName conn (sqlIdName t) <> "=?"
+                     Nothing   -> connEscapeName conn (fieldDB (entityId t)) <> "=?"
         let sql = T.concat
                 [ "SELECT "
                 , if noColumns then "*" else cols
@@ -208,7 +208,7 @@
         wher conn = 
               case entityPrimary t of
                 Just pdef -> T.intercalate " AND " $ map (\fld -> connEscapeName conn (fieldDB fld) <> "=? ") $ compositeFields pdef
-                Nothing   -> connEscapeName conn (sqlIdName t) <> "=?"
+                Nothing   -> connEscapeName conn (fieldDB (entityId t)) <> "=?"
         sql conn = T.concat
             [ "DELETE FROM "
             , connEscapeName conn $ entityDB t
@@ -236,7 +236,7 @@
         , "("
         , T.intercalate ","
             $ map (connEscapeName conn)
-            $ sqlIdName t : map fieldDB (entityFields t)
+            $ fieldDB (entityId t) : map fieldDB (entityFields t)
         , ") VALUES("
         , T.intercalate "," ("?" : map (const "?") (entityFields t))
         , ")"
diff --git a/Database/Persist/Sql/Orphan/PersistUnique.hs b/Database/Persist/Sql/Orphan/PersistUnique.hs
--- a/Database/Persist/Sql/Orphan/PersistUnique.hs
+++ b/Database/Persist/Sql/Orphan/PersistUnique.hs
@@ -5,7 +5,7 @@
 import Database.Persist
 import Database.Persist.Sql.Types
 import Database.Persist.Sql.Raw
-import Database.Persist.Sql.Orphan.PersistStore (withRawQuery, sqlIdName)
+import Database.Persist.Sql.Orphan.PersistStore (withRawQuery)
 import qualified Data.Text as T
 import Data.Monoid (mappend)
 import qualified Data.Conduit.List as CL
@@ -33,7 +33,7 @@
         let flds = map (connEscapeName conn . fieldDB) (entityFields t)
         let cols = case entityPrimary t of
                      Just _ -> T.intercalate "," flds
-                     Nothing -> T.intercalate "," $ connEscapeName conn (sqlIdName t) : flds
+                     Nothing -> T.intercalate "," $ connEscapeName conn (fieldDB (entityId t)) : flds
         let sql = T.concat
                 [ "SELECT "
                 , cols
diff --git a/persistent.cabal b/persistent.cabal
--- a/persistent.cabal
+++ b/persistent.cabal
@@ -1,5 +1,5 @@
 name:            persistent
-version:         2.0.4
+version:         2.0.5
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
