import qualified Karamaan.Opaleye.Reexports as R
import qualified Karamaan.Opaleye.Table as T
import qualified Karamaan.Opaleye.Operators2 as O
import qualified Karamaan.Opaleye.Aggregate as A
import qualified Karamaan.Opaleye.SQL as S
t :: R.Query (R.Wire Double)
t = T.makeTableDef "column" "table"
example :: R.Query (R.Wire Double)
example = A.aggregate A.sum (t `O.union` t)
run :: IO ()
run = fmap putStrLn S.showSqlForPostgresDefault example
*Main> run
(SELECT SUM(column) as column_1_3_4
FROM table as T1)
UNION
(SELECT SUM(column) as column_1_3_4
FROM table as T1)
https://github.com/m4dc4p/haskelldb/issues/17