on dev help sign in
clearer docs
c01892bEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+7−2
@@ -581,12 +581,17 @@ the given expressions evaluate to equal. The DISTINCT ON expressions are
581interpreted using the same rules as for ORDER BY. ORDER BY is used to
581interpreted using the same rules as for ORDER BY. ORDER BY is used to
582ensure that the desired row appears first.
582ensure that the desired row appears first.
583
583
584+The DISTINCT ON expression(s) must match the leftmost ORDER BY expression(s).
585+The ORDER BY clause will normally contain additional expression(s) that
586+determine the desired precedence of rows within each DISTINCT ON group.
587+
588+In order to guarantee they match, this function
584−The DISTINCT ON expressions will be pre-appended to the ORDER BY clause.
589+will prepend the The DISTINCT ON expressions to the ORDER BY clause.
585-}
590-}
586selectDistinctOn
591selectDistinctOn
587 :: (SListI columns, columns ~ (col ': cols))
592 :: (SListI columns, columns ~ (col ': cols))
588 => [SortExpression outer commons grp schemas params from]
593 => [SortExpression outer commons grp schemas params from]
589− -- ^ distinct on and return the first row in ordering
594+ -- ^ DISTINCT ON expression(s) and prepended to ORDER BY clause
590 -> Selection outer commons grp schemas params from columns
595 -> Selection outer commons grp schemas params from columns
591 -- ^ selection
596 -- ^ selection
592 -> TableExpression outer commons grp schemas params from
597 -> TableExpression outer commons grp schemas params from