on dev help sign in
polymorphise grouping for select distinct

and clarify docs

commit1bdb1365820997f3c107af77ee050abedd600afe authorEitan Chatav <eitan@EEM109LMBP-1.local> dateFri 18 Oct 2019, 14:09 (7 years ago) parentcfb3d8c
1 file changed+12−10
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+12−10
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+12−10
@@ -554,9 +554,9 @@ select_ = select . List
554554-- be subject to the elimination of duplicate rows using `selectDistinct`.
555555selectDistinct
556556 :: (SListI columns, columns ~ (col ': cols))
557− => Selection outer commons 'Ungrouped schemas params from columns
557+ => Selection outer commons grp schemas params from columns
558558 -- ^ selection
559− -> TableExpression outer commons 'Ungrouped schemas params from
559+ -> TableExpression outer commons grp schemas params from
560560 -- ^ intermediate virtual table
561561 -> Query outer commons schemas params columns
562562selectDistinct selection tabexpr = UnsafeQuery $
@@ -568,9 +568,9 @@ selectDistinct selection tabexpr = UnsafeQuery $
568568-- of a general `Selection`.
569569selectDistinct_
570570 :: (SListI columns, columns ~ (col ': cols))
571− => NP (Aliased (Expression outer commons 'Ungrouped schemas params from)) columns
571+ => NP (Aliased (Expression outer commons grp schemas params from)) columns
572572 -- ^ select list
573− -> TableExpression outer commons 'Ungrouped schemas params from
573+ -> TableExpression outer commons grp schemas params from
574574 -- ^ intermediate virtual table
575575 -> Query outer commons schemas params columns
576576selectDistinct_ = selectDistinct . List
@@ -580,14 +580,16 @@ selectDistinct_ = selectDistinct . List
580580the given expressions evaluate to equal. The DISTINCT ON expressions are
581581interpreted using the same rules as for ORDER BY. ORDER BY is used to
582582ensure that the desired row appears first.
583+
584+The DISTINCT ON expressions will be pre-appended to the ORDER BY clause.
583585-}
584586selectDistinctOn
585587 :: (SListI columns, columns ~ (col ': cols))
586− => [SortExpression outer commons 'Ungrouped schemas params from]
588+ => [SortExpression outer commons grp schemas params from]
587589 -- ^ distinct on and return the first row in ordering
588− -> Selection outer commons 'Ungrouped schemas params from columns
590+ -> Selection outer commons grp schemas params from columns
589591 -- ^ selection
590− -> TableExpression outer commons 'Ungrouped schemas params from
592+ -> TableExpression outer commons grp schemas params from
591593 -- ^ intermediate virtual table
592594 -> Query outer commons schemas params columns
593595selectDistinctOn distincts selection tab = UnsafeQuery $
@@ -608,11 +610,11 @@ selectDistinctOn distincts selection tab = UnsafeQuery $
608610-- of a general `Selection`.
609611selectDistinctOn_
610612 :: (SListI columns, columns ~ (col ': cols))
611− => [SortExpression outer commons 'Ungrouped schemas params from]
613+ => [SortExpression outer commons grp schemas params from]
612614 -- ^ distinct on and return the first row in ordering
613− -> NP (Aliased (Expression outer commons 'Ungrouped schemas params from)) columns
615+ -> NP (Aliased (Expression outer commons grp schemas params from)) columns
614616 -- ^ selection
615− -> TableExpression outer commons 'Ungrouped schemas params from
617+ -> TableExpression outer commons grp schemas params from
616618 -- ^ intermediate virtual table
617619 -> Query outer commons schemas params columns
618620selectDistinctOn_ distincts = selectDistinctOn distincts . List