diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Revision history for hiedb
 
+## 0.5.0.0 -- 2024-01-12
+
+- Handle duplicate record fields in GHC 9.8 instead of crashing
+
 ## 0.4.4.0 -- 2023-11-13
 * Add `--src-base-dir` option allowing for src file indexing in `mods`
 * 9.8.1 support
diff --git a/hiedb.cabal b/hiedb.cabal
--- a/hiedb.cabal
+++ b/hiedb.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.4
 name:                hiedb
-version:             0.4.4.0
+version:             0.5.0.0
 synopsis:            Generates a references DB from .hie files
 description:         Tool and library to index and query a collection of `.hie` files
 bug-reports:         https://github.com/wz1000/HieDb/issues
diff --git a/src/HieDb/Compat.hs b/src/HieDb/Compat.hs
--- a/src/HieDb/Compat.hs
+++ b/src/HieDb/Compat.hs
@@ -81,6 +81,9 @@
     , IfaceTyCon(..)
     , field_label
     , dfs
+    , fieldNameSpace_maybe
+    , fieldName
+    , mkFastStringByteString
 ) where
 
 import Compat.HieTypes
@@ -228,4 +231,17 @@
 dfs = Graph.dfs
 #else
 dfs = flip Graph.dfs
+#endif
+
+fieldNameSpace_maybe :: NameSpace -> Maybe FastString
+#if __GLASGOW_HASKELL__ >= 907
+-- This is horrible, we can improve it once
+-- https://gitlab.haskell.org/ghc/ghc/-/issues/24244 is addressed
+fieldNameSpace_maybe ns = fieldOcc_maybe (mkOccName ns "")
+#endif
+fieldNameSpace_maybe _ = Nothing
+
+#if __GLASGOW_HASKELL__ < 907
+fieldName :: FastString -> NameSpace
+fieldName _ = varName
 #endif
diff --git a/src/HieDb/Create.hs b/src/HieDb/Create.hs
--- a/src/HieDb/Create.hs
+++ b/src/HieDb/Create.hs
@@ -35,7 +35,7 @@
 import HieDb.Utils
 
 sCHEMA_VERSION :: Integer
-sCHEMA_VERSION = 6
+sCHEMA_VERSION = 7
 
 dB_VERSION :: Integer
 dB_VERSION = read (show sCHEMA_VERSION ++ "999" ++ show hieVersion)
@@ -285,7 +285,8 @@
   executeMany conn "INSERT INTO decls VALUES (?,?,?,?,?,?,?)" decls
 
   let defs = genDefRow path smod refmap
-  executeMany conn "INSERT INTO defs VALUES (?,?,?,?,?,?)" defs
+  forM defs $ \def -> do
+    execute conn "INSERT INTO defs VALUES (?,?,?,?,?,?)" def
 
   let exports = generateExports path $ hie_exports hf
   executeMany conn "INSERT INTO exports VALUES (?,?,?,?,?,?,?,?)" exports
diff --git a/src/HieDb/Query.hs b/src/HieDb/Query.hs
--- a/src/HieDb/Query.hs
+++ b/src/HieDb/Query.hs
@@ -224,7 +224,7 @@
 
     one :: Symbol -> IO [Vertex]
     one s = do
-      let n = toNsChar (occNameSpace $ symName s) : occNameString (symName s)
+      let n = symName s
           m = moduleNameString $ moduleName $ symModule s
           u = unitString (moduleUnit $ symModule s)
       query conn "SELECT mods.mod, decls.hieFile, decls.occ, decls.sl, decls.sc, decls.el, decls.ec \
diff --git a/src/HieDb/Types.hs b/src/HieDb/Types.hs
--- a/src/HieDb/Types.hs
+++ b/src/HieDb/Types.hs
@@ -15,6 +15,7 @@
 import Data.IORef
 
 import qualified Data.Text as T
+import qualified Data.Text.Encoding as T
 
 import Control.Monad.IO.Class
 import Control.Monad.Reader
@@ -90,32 +91,37 @@
 instance FromField Fingerprint where
   fromField fld = readHexFingerprint . T.unpack <$> fromField fld
 
-toNsChar :: NameSpace -> Char
+toNsChar :: NameSpace -> String
 toNsChar ns
-  | isVarNameSpace ns = 'v'
-  | isDataConNameSpace ns = 'c'
-  | isTcClsNameSpace ns  = 't'
-  | isTvNameSpace ns = 'z'
+  | Just fld_par <- fieldNameSpace_maybe ns
+  = ('f':unpackFS fld_par) ++ ":"
+  | isVarNameSpace ns = "v:"
+  | isDataConNameSpace ns = "c:"
+  | isTcClsNameSpace ns  = "t:"
+  | isTvNameSpace ns = "z:"
   | otherwise = error "namespace not recognized"
 
-fromNsChar :: Char -> Maybe NameSpace
-fromNsChar 'v' = Just varName
-fromNsChar 'c' = Just dataName
-fromNsChar 't' = Just tcClsName
-fromNsChar 'z' = Just tvName
-fromNsChar _ = Nothing
+fromNsChar :: T.Text -> Maybe NameSpace
+fromNsChar ns
+  | Just ('f',fieldNameSpace) <- T.uncons ns
+  = Just (fieldName $ mkFastStringByteString $ T.encodeUtf8 fieldNameSpace)
+fromNsChar "v" = Just varName
+fromNsChar "c" = Just dataName
+fromNsChar "t" = Just tcClsName
+fromNsChar "z" = Just tvName
+fromNsChar _   = Nothing
 
 instance ToField OccName where
-  toField occ = SQLText $ T.pack $ toNsChar (occNameSpace occ) : occNameString occ
+  toField occ = SQLText $ T.pack $ toNsChar (occNameSpace occ) ++ occNameString occ
 instance FromField OccName where
   fromField fld =
     case fieldData fld of
       SQLText t ->
-        case T.uncons t of
-          Just (nsChar,occ)
-            | Just ns <- fromNsChar nsChar ->
-              return $ mkOccName ns (T.unpack occ)
-          _ -> returnError ConversionFailed fld "OccName encoding invalid"
+        case T.break (== ':') t of
+          (nsText,occ)
+            | Just ns <- fromNsChar nsText ->
+              return $ mkOccName ns (T.unpack $ T.tail occ)
+          _ -> returnError ConversionFailed fld ("OccName encoding invalid: " ++ show t)
       _ -> returnError Incompatible fld "Expected a SQL string representing an OccName"
 
 data HieModuleRow
@@ -266,21 +272,22 @@
 
 instance Show Symbol where
     show s =  toNsChar (occNameSpace $ symName s)
-           :  ':'
-           :  occNameString (symName s)
-           <> ":"
-           <> moduleNameString (moduleName $ symModule s)
-           <> ":"
-        --    <> unitIdString (moduleUnit $ symModule s)
-           <> unitString (moduleUnit $ symModule s)
+           <> (  ':'
+              :  occNameString (symName s)
+              <> ":"
+              <> moduleNameString (moduleName $ symModule s)
+              <> ":"
+        --       <> unitIdString (moduleUnit $ symModule s)
+              <> unitString (moduleUnit $ symModule s)
+              )
 
 instance Read Symbol where
   readsPrec = const $ R.readP_to_S readSymbol
 
 readNameSpace :: R.ReadP NameSpace
 readNameSpace = do
-  c <- R.get
-  maybe R.pfail return (fromNsChar c)
+  c <- R.many1 R.get
+  maybe R.pfail return (fromNsChar $ T.pack c)
 
 readColon :: R.ReadP ()
 readColon = () <$ R.char ':'
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -180,7 +180,7 @@
       it "outputs the location of symbol when definition site can be found is indexed" $
         runHieDbCli ["point-defs", "Module1", "13", "29"]
           `succeedsWithStdin` unlines
-            [ "Sub.Module2:7:1-7:8"
+            [ "Sub.Module2:8:1-8:8"
             ]
       it "Fails with informative error message when there's no symbol at given point" $ do
         (exitCode, actualStdout, actualStderr) <- runHieDbCli ["point-defs", "Module1", "13", "13"]
@@ -196,39 +196,56 @@
 
     describe "point-info" $ do
       it "gives information about symbol at specified location" $
-        runHieDbCli ["point-info", "Sub.Module2", "10", "10"]
+        runHieDbCli ["point-info", "Sub.Module2", "11", "11"]
           `succeedsWithStdin` unlines
-            [ "Span: test/data/Sub/Module2.hs:10:7-23"
+            [ "Span: test/data/Sub/Module2.hs:11:7-23"
             , "Constructors: {(ConDeclH98, ConDecl)}"
             , "Identifiers:"
-            , "Symbol:c:Data1Constructor1:Sub.Module2:main"
-            , "Data1Constructor1 defined at test/data/Sub/Module2.hs:10:7-23"
+            , "Symbol:c::Data1Constructor1:Sub.Module2:main"
+            , "Data1Constructor1 defined at test/data/Sub/Module2.hs:11:7-23"
 #if __GLASGOW_HASKELL__ >= 900
-            , "    Details:  Nothing {declaration of constructor bound at: test/data/Sub/Module2.hs:10:7-23}"
+            , "    Details:  Nothing {declaration of constructor bound at: test/data/Sub/Module2.hs:11:7-23}"
 #else
-            , "    IdentifierDetails Nothing {Decl ConDec (Just SrcSpanOneLine \"test/data/Sub/Module2.hs\" 10 7 24)}"
+            , "    IdentifierDetails Nothing {Decl ConDec (Just SrcSpanOneLine \"test/data/Sub/Module2.hs\" 11 7 24)}"
 #endif
             , "Types:\n"
             ]
       it "correctly prints type signatures" $
         runHieDbCli ["point-info", "Module1", "10", "10"]
           `succeedsWithStdin` unlines
+#if __GLASGOW_HASKELL__ >= 904
             [ "Span: test/data/Module1.hs:10:8-11"
-#if __GLASGOW_HASKELL__ >= 902
+            , "Constructors: {(HsVar, HsExpr), (XExpr, HsExpr)}"
+            , "Identifiers:"
+            , "$dIntegral defined at <no location info>"
+            , "    Details:  Just Integral Int {usage of evidence variable}"
+            , "Symbol:v::even:GHC.Real:base"
+            , "even defined at <no location info>"
+            , "    Details:  Just forall a. Integral a => a -> Bool {usage}"
+#elif __GLASGOW_HASKELL__ >= 902
+            [ "Span: test/data/Module1.hs:10:8-11"
             , "Constructors: {(XExpr, HsExpr), (HsVar, HsExpr)}"
+            , "Identifiers:"
+            , "Symbol:v::even:GHC.Real:base"
+            , "even defined at <no location info>"
+            , "    Details:  Just forall a. Integral a => a -> Bool {usage}"
+            , "$dIntegral defined at <no location info>"
+            , "    Details:  Just Integral Int {usage of evidence variable}"
 #elif __GLASGOW_HASKELL__ >= 900
+            [ "Span: test/data/Module1.hs:10:8-11"
             , "Constructors: {(HsVar, HsExpr), (XExpr, HsExpr)}"
-#else
-            , "Constructors: {(HsVar, HsExpr), (HsWrap, HsExpr)}"
-#endif
             , "Identifiers:"
-            , "Symbol:v:even:GHC.Real:base"
+            , "Symbol:v::even:GHC.Real:base"
             , "even defined at <no location info>"
-#if __GLASGOW_HASKELL__ >= 900
             , "    Details:  Just forall a. Integral a => a -> Bool {usage}"
             , "$dIntegral defined at <no location info>"
             , "    Details:  Just Integral Int {usage of evidence variable}"
 #else
+            [ "Span: test/data/Module1.hs:10:8-11"
+            , "Constructors: {(HsVar, HsExpr), (HsWrap, HsExpr)}"
+            , "Identifiers:"
+            , "Symbol:v::even:GHC.Real:base"
+            , "even defined at <no location info>"
             , "    IdentifierDetails Just forall a. Integral a => a -> Bool {Use}"
 #endif
             , "Types:"
@@ -240,12 +257,12 @@
     describe "name-def" $
       it "lookup definition of name" $
         runHieDbCli ["name-def", "showInt"]
-          `succeedsWithStdin` "Sub.Module2:7:1-7:8\n"
+          `succeedsWithStdin` "Sub.Module2:8:1-8:8\n"
 
     describe "type-def" $
       it "lookup definition of type" $
         runHieDbCli ["type-def", "Data1"]
-          `succeedsWithStdin` "Sub.Module2:9:1-11:28\n"
+          `succeedsWithStdin` "Sub.Module2:10:1-12:28\n"
 
     describe "cat" $
       describe "dumps module source stored in .hie file" $ do
diff --git a/test/data/Sub/Module2.hs b/test/data/Sub/Module2.hs
--- a/test/data/Sub/Module2.hs
+++ b/test/data/Sub/Module2.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DuplicateRecordFields #-}
 module Sub.Module2
     ( showInt
     , Data1(..)
@@ -9,3 +10,9 @@
 data Data1
     = Data1Constructor1
     | Data1Constructor2 Int
+
+data Data2
+    = Data2C { foo :: Int, bar :: String }
+
+data Data3
+    = Data3C { foo :: Int, baz :: Bool }
