@@ -1608,23 +1608,12 @@ tsHeadline = unsafeFunctionHet "ts_headline"
1608aggregation
1608aggregation
1609-----------------------------------------}
1609-----------------------------------------}
1611−type AggrFun x y
1611+unsafeAggregateHet
1612− = forall outer bys commons schemas params from
1612+ :: SOP.SListI xs
1613− . Distinction (Expression outer commons 'Ungrouped schemas params from) x
1613+ => ByteString -- ^ function
1615− -> Expression outer commons ('Grouped bys) schemas params from y
1619− = forall outer bys commons schemas params from
1620− . Distinction (NP (Expression outer commons 'Ungrouped schemas params from)) xs
1614+ -> Distinction (NP (Expression outer commons 'Ungrouped schemas params from)) xs
1622 -> Expression outer commons ('Grouped bys) schemas params from y
1615 -> Expression outer commons ('Grouped bys) schemas params from y
1625−unsafeAggregateHet :: SOP.SListI xs => ByteString -> AggrHet xs y
1626−unsafeAggregateHet fun xs = UnsafeExpression $ mconcat
1616+unsafeAggregateHet fun xs = UnsafeExpression $ fun <> parenthesized (renderSQL xs)
1627− [fun, "(", renderSQL xs, ")"]
1630`Aggregate` functions compute a single result from a set of input values.
1619`Aggregate` functions compute a single result from a set of input values.
@@ -2032,9 +2021,9 @@ instance Aggregate
2032-- | escape hatch to define aggregate functions
2021-- | escape hatch to define aggregate functions
2033unsafeAggregate1
2022unsafeAggregate1
2034 :: ByteString -- ^ aggregate function
2023 :: ByteString -- ^ aggregate function
2035− -> AggrFun xty yty
2024+ -> Distinction (Expression outer commons 'Ungrouped schemas params from) x
2025+ -> Expression outer commons ('Grouped bys) schemas params from y
2036−unsafeAggregate1 fun x = UnsafeExpression $ mconcat
2026+unsafeAggregate1 fun x = UnsafeExpression $ fun <> parenthesized (renderSQL x)
2037− [fun, "(", renderSQL x, ")"]
2039-- | A type family that calculates `PGAvg` type of a `PGType`.
2028-- | A type family that calculates `PGAvg` type of a `PGType`.
2040type family PGAvg ty where
2029type family PGAvg ty where