-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
This query:
mBool <- selectOne $ do
pure $ val Nothing `in_` justList (valList [1, 2, 3 :: Int])
liftIO $ print mBool
Shows me:
PersistMarshalError "Failed to parse Haskell type `Bool`; expected boolean, integer, or bytestring of '1' or '0' from database, but received: PersistNull. Potential solution: Check that your database schema matches your Persistent model definitions."
HasCallStack backtrace:
collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception
toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
throwIO, called at ./Control/Monad/Trans/Resource.hs:195:13 in resourcet-1.3.0-BnXEVAikP2m1jrdnAev1wT:Control.Monad.Trans.Resource
In other words, the type of in_ is a lie, and should return Value (Maybe Bool) instead of Value Bool when the first argument can be NULL.
I ran this test on SQLite. I'm not sure what would/should happen on PostgreSQL.
Metadata
Metadata
Assignees
Labels
No labels