@@ -581,12 +581,17 @@ the 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.
583583
584−The DISTINCT ON expressions will be pre-appended to the ORDER BY clause.
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
589+will prepend the The DISTINCT ON expressions to the ORDER BY clause.
585590-}
586591selectDistinctOn
587592 :: (SListI columns, columns ~ (col ': cols))
588593 => [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
590595 -> Selection outer commons grp schemas params from columns
591596 -- ^ selection
592597 -> TableExpression outer commons grp schemas params from