Calling coalesce, or coalesceDefault with sub_select like here:
ret <- select $
from $ \b -> do
let sub =
from $ \p -> do
where_ (p ^. PersonId ==. b ^. BlogPostAuthorId)
return $ p ^. PersonAge
return $ coalesceDefault [sub_select sub] (val (42 :: Int))
causes the following run-time error (formatted for readability):
uncaught exception: IOException of type UserError
(user error (SQLite3 returned ErrorError while attempting to perform prepare
"SELECT COALESCE(SELECT \"Person\".\"age\"
FROM \"Person\"
WHERE \"Person\".\"id\" = \"BlogPost\".\"authorId\"
, ?)
FROM \"BlogPost\"
": near "SELECT": syntax error))
I.e. the sub-query is missing an extra pair of parentheses around it.
I found a fix for which I will create a PR shortly.
Calling
coalesce
, orcoalesceDefault
withsub_select
like here:causes the following run-time error (formatted for readability):
I.e. the sub-query is missing an extra pair of parentheses around it.
I found a fix for which I will create a PR shortly.