test case for multiple DISTINCT ON columns
This commit is contained in:
parent
d96b3088f3
commit
ba9791b6b4
@ -1 +1,4 @@
|
|||||||
|
flags:
|
||||||
|
esqueleto:
|
||||||
|
postgresql: true
|
||||||
resolver: nightly-2015-06-09
|
resolver: nightly-2015-06-09
|
||||||
|
|||||||
@ -818,7 +818,7 @@ main = do
|
|||||||
, BlogPost "C" p2k ]
|
, BlogPost "C" p2k ]
|
||||||
ret <- select $
|
ret <- select $
|
||||||
from $ \bp ->
|
from $ \bp ->
|
||||||
distinctOn [bp ^. BlogPostAuthorId] $ do
|
distinctOn [bp ^. BlogPostAuthorId, bp ^. BlogPostTitle] $ do
|
||||||
orderBy [asc (bp ^. BlogPostAuthorId), desc (bp ^. BlogPostTitle)]
|
orderBy [asc (bp ^. BlogPostAuthorId), desc (bp ^. BlogPostTitle)]
|
||||||
return bp
|
return bp
|
||||||
liftIO $ ret `shouldBe` sortBy (comparing (blogPostAuthorId . entityVal)) [bpB, bpC]
|
liftIO $ ret `shouldBe` sortBy (comparing (blogPostAuthorId . entityVal)) [bpB, bpC]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user