diff --git a/relational-query/src/Database/Relational/Query/Component.hs b/relational-query/src/Database/Relational/Query/Component.hs index 49df98ec..00627489 100644 --- a/relational-query/src/Database/Relational/Query/Component.hs +++ b/relational-query/src/Database/Relational/Query/Component.hs @@ -223,6 +223,7 @@ composeValues :: [Assignment] -> StringSQL composeValues = BaseSQL.composeValues +{-# DEPRECATED composeOver "prepare to drop public interface." #-} -- | Compose /OVER (PARTITION BY ... )/ clause. composeOver :: [AggregateColumnRef] -> OrderingTerms -> StringSQL composeOver pts ots = diff --git a/relational-query/src/Database/Relational/Query/Monad/Aggregate.hs b/relational-query/src/Database/Relational/Query/Monad/Aggregate.hs index 5948b405..778f5476 100644 --- a/relational-query/src/Database/Relational/Query/Monad/Aggregate.hs +++ b/relational-query/src/Database/Relational/Query/Monad/Aggregate.hs @@ -29,13 +29,16 @@ module Database.Relational.Query.Monad.Aggregate ( import Data.Functor.Identity (Identity (runIdentity)) import Data.Monoid ((<>)) +import Language.SQL.Keyword (Keyword(..)) +import qualified Language.SQL.Keyword as SQL + import Database.Relational.Query.Internal.SQL (showsColumnSQL) +import Database.Relational.Query.Internal.BaseSQL (Duplication, OrderingTerm, composeOrderBy) +import Database.Relational.Query.Internal.GroupingSQL (AggregateColumnRef, AggregateElem, composePartitionBy) import Database.Relational.Query.Context (Flat, Aggregated, OverWindow) import Database.Relational.Query.Projection (Projection) import qualified Database.Relational.Query.Projection as Projection -import Database.Relational.Query.Component - (AggregateColumnRef, Duplication, OrderingTerm, AggregateElem, composeOver) import Database.Relational.Query.Sub (SubQuery, QueryRestriction, JoinProduct, aggregatedSubQuery) import qualified Database.Relational.Query.Sub as SubQuery import Database.Relational.Query.Projectable (PlaceHolders, SqlProjectable) @@ -94,7 +97,7 @@ over :: SqlProjectable (Projection c) -> Projection c a wp `over` win = Projection.unsafeFromSqlTerms - [ showsColumnSQL c <> composeOver pt ot + [ showsColumnSQL c <> OVER <> SQL.paren (composePartitionBy pt <> composeOrderBy ot) | c <- Projection.columns wp ] where (((), ot), pt) = extractWindow win