Just playing around with pg-orm for the first time. Created the typical user-post-comments data model, and was surprised with the following:
userPosts :: Association User Post
userPosts = has
postUser :: Association Post User
postUser = belongsTo
main = do
-- snip
putStrLn "Finding user with posts..."
r <- dbSelect conn $ assocSelect userPosts
putStrLn $ show r
-- OUTPUT: []
It seems that assocSelect uses an inner-join, which means that if a user doesn't have any posts, the entire row is not returned. Is this intended?
What's the easiest way to select a user, along with posts, but still return the user's row irrespective of whether he/she has posts, or not?