persistent-postgresql 2.1.3 → 2.1.4
raw patch · 3 files changed
+11/−31 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Database/Persist/Postgresql.hs +6/−30
- persistent-postgresql.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.1.4++* Treat unknown extension types as PersistDbSpecific values [#385](https://github.com/yesodweb/persistent/pull/385)+ ## 2.1.3 * Added a `Show` instance for `PostgresConf`.
Database/Persist/Postgresql.hs view
@@ -227,9 +227,8 @@ rowRef <- newIORef (LibPQ.Row 0) rowCount <- LibPQ.ntuples ret return (ret, rowRef, rowCount, oids)- getters <- forM ids $ \(col, oid) -> do- getter <- getGetter conn oid- return $ getter $ PG.Field rt col oid+ let getters+ = map (\(col, oid) -> getGetter conn oid $ PG.Field rt col oid) ids return (rt, rr, rc, getters) closeS (ret, _, _, _) = LibPQ.unsafeFreeResult ret@@ -321,13 +320,9 @@ , (k PS.varbit, convertPV PersistInt64) , (k PS.numeric, convertPV PersistRational) , (k PS.void, \_ _ -> return PersistNull)- , (k PS.uuid, convertPV (PersistDbSpecific . unUnknown)) , (k PS.json, convertPV (PersistByteString . unUnknown)) , (k PS.jsonb, convertPV (PersistByteString . unUnknown)) , (k PS.unknown, convertPV (PersistByteString . unUnknown))- -- add Inet and Cidr types- , (k PS.inet, convertPV (PersistDbSpecific . unUnknown))- , (k PS.cidr, convertPV (PersistDbSpecific . unUnknown)) @@ -365,29 +360,10 @@ k (PGFF.typoid -> i) = PG.oid2int i listOf f = convertPV (PersistList . map f . PG.fromPGArray) -builtinExtensionGetters :: Map.Map ByteString (Getter PersistValue)-builtinExtensionGetters = Map.fromList- [ ("geometry", convertPV (PersistDbSpecific . unUnknown))- , ("geography", convertPV (PersistDbSpecific . unUnknown))- ]---getGetter :: PG.Connection -> PG.Oid -> IO (Getter PersistValue)-getGetter conn oid = case I.lookup (PG.oid2int oid) builtinGetters of- Just getter -> return getter- Nothing -> do- tyinfo <- PG.getTypeInfo conn oid- case Map.lookup (PG.typname tyinfo) builtinExtensionGetters of- Just getter -> return getter- Nothing -> error $ "Postgresql.getGetter: type "- ++ explain tyinfo- ++ " ("- ++ show oid- ++ ") not supported."- where- explain tyinfo = case B8.unpack $ PG.typname tyinfo of- t@('_':ty) -> t ++ " (array of " ++ ty ++ ")"- x -> show x+getGetter :: PG.Connection -> PG.Oid -> Getter PersistValue+getGetter conn oid+ = fromMaybe defaultGetter $ I.lookup (PG.oid2int oid) builtinGetters+ where defaultGetter = convertPV (PersistDbSpecific . unUnknown) unBinary :: PG.Binary a -> a unBinary (PG.Binary x) = x
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.1.3+version: 2.1.4 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>