Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-persistent for openSUSE:Factory checked in at 2024-02-16 21:42:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-persistent (Old) and /work/SRC/openSUSE:Factory/.ghc-persistent.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent" Fri Feb 16 21:42:04 2024 rev:40 rq:1146979 version:2.14.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-persistent/ghc-persistent.changes 2023-11-23 21:42:00.158484679 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-persistent.new.1815/ghc-persistent.changes 2024-02-16 21:42:10.441307063 +0100 @@ -1,0 +2,11 @@ +Thu Feb 8 20:24:57 UTC 2024 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.6.1. + ## 2.14.6.1 + + * [#1528](https://github.com/yesodweb/persistent/pull/1528) + * The `PersistField Int{,8,16,32,64}` instances will now work with a + `PersistRational`, provided that the denominator is 1. This fixes the bug + where `SUM` in Postgres would change the type of a column being summed. + +------------------------------------------------------------------- Old: ---- persistent-2.14.6.0.tar.gz New: ---- persistent-2.14.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-persistent.spec ++++++ --- /var/tmp/diff_new_pack.0DLMsq/_old 2024-02-16 21:42:11.077330011 +0100 +++ /var/tmp/diff_new_pack.0DLMsq/_new 2024-02-16 21:42:11.077330011 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-persistent # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.14.6.0 +Version: 2.14.6.1 Release: 0 Summary: Type-safe, multi-backend data serialization License: MIT ++++++ persistent-2.14.6.0.tar.gz -> persistent-2.14.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.6.0/ChangeLog.md new/persistent-2.14.6.1/ChangeLog.md --- old/persistent-2.14.6.0/ChangeLog.md 2023-10-04 01:48:34.000000000 +0200 +++ new/persistent-2.14.6.1/ChangeLog.md 2024-02-08 21:24:53.000000000 +0100 @@ -1,5 +1,12 @@ # Changelog for persistent +## 2.14.6.1 + +* [#1528](https://github.com/yesodweb/persistent/pull/1528) + * The `PersistField Int{,8,16,32,64}` instances will now work with a + `PersistRational`, provided that the denominator is 1. This fixes the bug + where `SUM` in Postgres would change the type of a column being summed. + ## 2.14.6.0 * [#1477](https://github.com/yesodweb/persistent/pull/1477) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.6.0/Database/Persist/Class/PersistField.hs new/persistent-2.14.6.1/Database/Persist/Class/PersistField.hs --- old/persistent-2.14.6.0/Database/Persist/Class/PersistField.hs 2023-09-07 19:20:05.000000000 +0200 +++ new/persistent-2.14.6.1/Database/Persist/Class/PersistField.hs 2024-02-08 21:24:53.000000000 +0100 @@ -33,6 +33,7 @@ import Text.Blaze.Html import Text.Blaze.Html.Renderer.Text (renderHtml) import GHC.TypeLits +import Data.Ratio (numerator, denominator) import Database.Persist.Types.Base @@ -135,49 +136,49 @@ instance PersistField Int where toPersistValue = PersistInt64 . fromIntegral - fromPersistValue (PersistInt64 i) = Right $ fromIntegral i - fromPersistValue (PersistDouble i) = Right (truncate i :: Int) -- oracle - fromPersistValue x = Left $ fromPersistValueError "Int" "integer" x + fromPersistValue = fromPersistValueIntegral "Int" "integer" instance PersistField Int8 where toPersistValue = PersistInt64 . fromIntegral - fromPersistValue (PersistInt64 i) = Right $ fromIntegral i - fromPersistValue (PersistDouble i) = Right (truncate i :: Int8) -- oracle - fromPersistValue (PersistByteString bs) = case readInt bs of -- oracle - Just (i,"") -> Right $ fromIntegral i - Just (i,extra) -> Left $ extraInputError "Int64" bs i extra - Nothing -> Left $ intParseError "Int64" bs - fromPersistValue x = Left $ fromPersistValueError "Int8" "integer" x + fromPersistValue = fromPersistValueIntegral "Int8" "integer" instance PersistField Int16 where toPersistValue = PersistInt64 . fromIntegral - fromPersistValue (PersistInt64 i) = Right $ fromIntegral i - fromPersistValue (PersistDouble i) = Right (truncate i :: Int16) -- oracle - fromPersistValue (PersistByteString bs) = case readInt bs of -- oracle - Just (i,"") -> Right $ fromIntegral i - Just (i,extra) -> Left $ extraInputError "Int64" bs i extra - Nothing -> Left $ intParseError "Int64" bs - fromPersistValue x = Left $ fromPersistValueError "Int16" "integer" x + fromPersistValue = fromPersistValueIntegral "Int16" "integer" instance PersistField Int32 where toPersistValue = PersistInt64 . fromIntegral - fromPersistValue (PersistInt64 i) = Right $ fromIntegral i - fromPersistValue (PersistDouble i) = Right (truncate i :: Int32) -- oracle - fromPersistValue (PersistByteString bs) = case readInt bs of -- oracle - Just (i,"") -> Right $ fromIntegral i - Just (i,extra) -> Left $ extraInputError "Int64" bs i extra - Nothing -> Left $ intParseError "Int64" bs - fromPersistValue x = Left $ fromPersistValueError "Int32" "integer" x + fromPersistValue = fromPersistValueIntegral "Int32" "integer" instance PersistField Int64 where toPersistValue = PersistInt64 - fromPersistValue (PersistInt64 i) = Right i - fromPersistValue (PersistDouble i) = Right (truncate i :: Int64) -- oracle - fromPersistValue (PersistByteString bs) = case readInt bs of -- oracle - Just (i,"") -> Right $ fromIntegral i - Just (i,extra) -> Left $ extraInputError "Int64" bs i extra - Nothing -> Left $ intParseError "Int64" bs - fromPersistValue x = Left $ fromPersistValueError "Int64" "integer" x + fromPersistValue = fromPersistValueIntegral "Int64" "integer" + +fromPersistValueIntegral :: Integral a => Text -> Text -> PersistValue -> Either Text a +fromPersistValueIntegral haskellType sqlType pv = case pv of + PersistInt64 i -> + Right (fromIntegral i) + PersistDouble i -> + Right $ truncate i -- oracle + PersistRational i -> + case denominator i of + 1 -> + Right $ fromIntegral $ numerator i + _denom -> + boom + PersistByteString bs -> + case readInt bs of -- oracle + Just (i,"") -> + Right $ fromIntegral i + Just (i,extra) -> + Left $ extraInputError haskellType bs i extra + Nothing -> + Left $ intParseError haskellType bs + _ -> + boom + where + boom = + Left $ fromPersistValueError haskellType sqlType pv extraInputError :: (Show result) => Text -- ^ Haskell type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.6.0/persistent.cabal new/persistent-2.14.6.1/persistent.cabal --- old/persistent-2.14.6.0/persistent.cabal 2023-10-04 01:10:59.000000000 +0200 +++ new/persistent-2.14.6.1/persistent.cabal 2024-02-08 21:24:53.000000000 +0100 @@ -1,5 +1,5 @@ name: persistent -version: 2.14.6.0 +version: 2.14.6.1 license: MIT license-file: LICENSE author: Michael Snoyman <[email protected]>
