@@ -172,6 +172,9 @@ newtype Expression
172172 = UnsafeExpression { renderExpression :: ByteString }
173173 deriving (GHC.Generic,Show,Eq,Ord,NFData)
174174
175+instance RenderSQL (Expression schema relations grouping params ty) where
176+ renderSQL = renderExpression
177+
175178{- | A `HasParameter` constraint is used to indicate a value that is
176179supplied externally to a SQL statement.
177180`Squeal.PostgreSQL.PQ.manipulateParams`,
@@ -278,15 +281,15 @@ instance
278281
279282-- | analagous to `Nothing`
280283--
281−-- >>> renderExpression $ null_
282−-- "NULL"
284+-- >>> printSQL null_
285+-- NULL
283286null_ :: Expression schema rels grouping params ('Null ty)
284287null_ = UnsafeExpression "NULL"
285288
286289-- | analagous to `Just`
287290--
288−-- >>> renderExpression $ notNull true
289−-- "TRUE"
291+-- >>> printSQL $ notNull true
292+-- TRUE
290293notNull
291294 :: Expression schema rels grouping params ('NotNull ty)
292295 -> Expression schema rels grouping params ('Null ty)
@@ -294,8 +297,8 @@ notNull = UnsafeExpression . renderExpression
294297
295298-- | return the leftmost value which is not NULL
296299--
297−-- >>> renderExpression $ coalesce [null_, notNull true] false
298−-- "COALESCE(NULL, TRUE, FALSE)"
300+-- >>> printSQL $ coalesce [null_, notNull true] false
301+-- COALESCE(NULL, TRUE, FALSE)
299302coalesce
300303 :: [Expression schema relations grouping params ('Null ty)]
301304 -- ^ @NULL@s may be present
@@ -308,8 +311,8 @@ coalesce nullxs notNullx = UnsafeExpression $
308311
309312-- | analagous to `Data.Maybe.fromMaybe` using @COALESCE@
310313--
311−-- >>> renderExpression $ fromNull true null_
312−-- "COALESCE(NULL, TRUE)"
314+-- >>> printSQL $ fromNull true null_
315+-- COALESCE(NULL, TRUE)
313316fromNull
314317 :: Expression schema relations grouping params ('NotNull ty)
315318 -- ^ what to convert @NULL@ to
@@ -317,16 +320,16 @@ fromNull
317320 -> Expression schema relations grouping params ('NotNull ty)
318321fromNull notNullx nullx = coalesce [nullx] notNullx
319322
320−-- | >>> renderExpression $ null_ & isNull
321−-- "NULL IS NULL"
323+-- | >>> printSQL $ null_ & isNull
324+-- NULL IS NULL
322325isNull
323326 :: Expression schema relations grouping params ('Null ty)
324327 -- ^ possibly @NULL@
325328 -> Condition schema relations grouping params
326329isNull x = UnsafeExpression $ renderExpression x <+> "IS NULL"
327330
328−-- | >>> renderExpression $ null_ & isNotNull
329−-- "NULL IS NOT NULL"
331+-- | >>> printSQL $ null_ & isNotNull
332+-- NULL IS NOT NULL
330333isNotNull
331334 :: Expression schema relations grouping params ('Null ty)
332335 -- ^ possibly @NULL@
@@ -335,8 +338,8 @@ isNotNull x = UnsafeExpression $ renderExpression x <+> "IS NOT NULL"
335338
336339-- | analagous to `maybe` using @IS NULL@
337340--
338−-- >>> renderExpression $ matchNull true not_ null_
339−-- "CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END"
341+-- >>> printSQL $ matchNull true not_ null_
342+-- CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END
340343matchNull
341344 :: Expression schema relations grouping params (nullty)
342345 -- ^ what to convert @NULL@ to
@@ -348,12 +351,14 @@ matchNull
348351matchNull y f x = ifThenElse (isNull x) y
349352 (f (UnsafeExpression (renderExpression x)))
350353
351−-- | right inverse to `fromNull`, if its arguments are equal then
352−-- `nullIf` gives @NULL@.
353−--
354−-- >>> :set -XTypeApplications -XDataKinds
355−-- >>> renderExpression @'[] @_ @_ @'[_] $ fromNull false (nullIf false (param @1))
356−-- "COALESCE(NULL IF (FALSE, ($1 :: bool)), FALSE)"
354+{-| right inverse to `fromNull`, if its arguments are equal then
355+`nullIf` gives @NULL@.
356+
357+>>> :set -XTypeApplications -XDataKinds
358+>>> let expr = nullIf false (param @1) :: Expression schema rels grp '[ 'NotNull 'PGbool] ('Null 'PGbool)
359+>>> printSQL expr
360+NULL IF (FALSE, ($1 :: bool))
361+-}
357362nullIf
358363 :: Expression schema relations grouping params ('NotNull ty)
359364 -- ^ @NULL@ is absent
@@ -363,8 +368,8 @@ nullIf
363368nullIf x y = UnsafeExpression $ "NULL IF" <+> parenthesized
364369 (renderExpression x <> ", " <> renderExpression y)
365370
366−-- | >>> renderExpression $ array [null_, notNull false, notNull true]
367−-- "ARRAY[NULL, FALSE, TRUE]"
371+-- | >>> printSQL $ array [null_, notNull false, notNull true]
372+-- ARRAY[NULL, FALSE, TRUE]
368373array
369374 :: [Expression schema relations grouping params ('Null ty)]
370375 -- ^ array elements
@@ -381,8 +386,8 @@ instance (KnownSymbol label, label `In` labels) => IsPGlabel label
381386--
382387-- >>> type Complex = PGcomposite '["real" ::: 'PGfloat8, "imaginary" ::: 'PGfloat8]
383388-- >>> let i = row (0 `As` #real :* 1 `As` #imaginary :* Nil) :: Expression '[] '[] 'Ungrouped '[] ('NotNull Complex)
384−-- >>> renderExpression i
385−-- "ROW(0, 1)"
389+-- >>> printSQL i
390+-- ROW(0, 1)
386391row
387392 :: SListI (Nulls fields)
388393 => NP (Aliased (Expression schema relations grouping params)) (Nulls fields)
@@ -407,8 +412,9 @@ instance Monoid
407412 mempty = array []
408413 mappend = (<>)
409414
410−-- | >>> renderExpression @'[] @_ @_ @'[_] $ greatest currentTimestamp [param @1]
411−-- "GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))"
415+-- | >>> let expr = greatest currentTimestamp [param @1] :: Expression sch rels grp '[ 'NotNull 'PGtimestamptz] ('NotNull 'PGtimestamptz)
416+-- >>> printSQL expr
417+-- GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))
412418greatest
413419 :: Expression schema relations grouping params (nullty)
414420 -- ^ needs at least 1 argument
@@ -418,8 +424,8 @@ greatest
418424greatest x xs = UnsafeExpression $ "GREATEST("
419425 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
420426
421−-- | >>> renderExpression $ least currentTimestamp [null_]
422−-- "LEAST(CURRENT_TIMESTAMP, NULL)"
427+-- | >>> printSQL $ least currentTimestamp [null_]
428+-- LEAST(CURRENT_TIMESTAMP, NULL)
423429least
424430 :: Expression schema relations grouping params (nullty)
425431 -- ^ needs at least 1 argument
@@ -429,8 +435,8 @@ least
429435least x xs = UnsafeExpression $ "LEAST("
430436 <> commaSeparated (renderExpression <$> (x:xs)) <> ")"
431437
432−-- | >>> renderExpression $ unsafeBinaryOp "OR" true false
433−-- "(TRUE OR FALSE)"
438+-- | >>> printSQL $ unsafeBinaryOp "OR" true false
439+-- (TRUE OR FALSE)
434440unsafeBinaryOp
435441 :: ByteString
436442 -- ^ operator
@@ -440,8 +446,8 @@ unsafeBinaryOp
440446unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
441447 renderExpression x <+> op <+> renderExpression y
442448
443−-- | >>> renderExpression $ unsafeUnaryOp "NOT" true
444−-- "(NOT TRUE)"
449+-- | >>> printSQL $ unsafeUnaryOp "NOT" true
450+-- (NOT TRUE)
445451unsafeUnaryOp
446452 :: ByteString
447453 -- ^ operator
@@ -450,8 +456,8 @@ unsafeUnaryOp
450456unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
451457 op <+> renderExpression x
452458
453−-- | >>> renderExpression $ unsafeFunction "f" true
454−-- "f(TRUE)"
459+-- | >>> printSQL $ unsafeFunction "f" true
460+-- f(TRUE)
455461unsafeFunction
456462 :: ByteString
457463 -- ^ function
@@ -503,9 +509,9 @@ instance (PGNum ty, PGFloating ty) => Floating
503509-- let
504510-- expression :: Expression schema relations grouping params (nullity 'PGfloat4)
505511-- expression = atan2_ pi 2
506−-- in renderExpression expression
512+-- in printSQL expression
507513-- :}
508−-- "atan2(pi(), 2)"
514+-- atan2(pi(), 2)
509515atan2_
510516 :: PGFloating float
511517 => Expression schema relations grouping params (nullity float)
@@ -520,8 +526,8 @@ atan2_ y x = UnsafeExpression $
520526-- represents a run-time type conversion. The cast will succeed only if a
521527-- suitable type conversion operation has been defined.
522528--
523−-- | >>> renderExpression $ true & cast int4
524−-- "(TRUE :: int4)"
529+-- | >>> printSQL $ true & cast int4
530+-- (TRUE :: int4)
525531cast
526532 :: TypeExpression schema ty1
527533 -- ^ type to cast as
@@ -537,9 +543,9 @@ cast ty x = UnsafeExpression $ parenthesized $
537543-- let
538544-- expression :: Expression schema relations grouping params (nullity 'PGint2)
539545-- expression = 5 `quot_` 2
540−-- in renderExpression expression
546+-- in printSQL expression
541547-- :}
542−-- "(5 / 2)"
548+-- (5 / 2)
543549quot_
544550 :: PGIntegral int
545551 => Expression schema relations grouping params (nullity int)
@@ -555,9 +561,9 @@ quot_ = unsafeBinaryOp "/"
555561-- let
556562-- expression :: Expression schema relations grouping params (nullity 'PGint2)
557563-- expression = 5 `rem_` 2
558−-- in renderExpression expression
564+-- in printSQL expression
559565-- :}
560−-- "(5 % 2)"
566+-- (5 % 2)
561567rem_
562568 :: PGIntegral int
563569 => Expression schema relations grouping params (nullity int)
@@ -571,9 +577,9 @@ rem_ = unsafeBinaryOp "%"
571577-- let
572578-- expression :: Expression schema relations grouping params (nullity 'PGfloat4)
573579-- expression = trunc pi
574−-- in renderExpression expression
580+-- in printSQL expression
575581-- :}
576−-- "trunc(pi())"
582+-- trunc(pi())
577583trunc
578584 :: PGFloating frac
579585 => Expression schema relations grouping params (nullity frac)
@@ -585,9 +591,9 @@ trunc = unsafeFunction "trunc"
585591-- let
586592-- expression :: Expression schema relations grouping params (nullity 'PGfloat4)
587593-- expression = round_ pi
588−-- in renderExpression expression
594+-- in printSQL expression
589595-- :}
590−-- "round(pi())"
596+-- round(pi())
591597round_
592598 :: PGFloating frac
593599 => Expression schema relations grouping params (nullity frac)
@@ -599,9 +605,9 @@ round_ = unsafeFunction "round"
599605-- let
600606-- expression :: Expression schema relations grouping params (nullity 'PGfloat4)
601607-- expression = ceiling_ pi
602−-- in renderExpression expression
608+-- in printSQL expression
603609-- :}
604−-- "ceiling(pi())"
610+-- ceiling(pi())
605611ceiling_
606612 :: PGFloating frac
607613 => Expression schema relations grouping params (nullity frac)
@@ -616,33 +622,33 @@ ceiling_ = unsafeFunction "ceiling"
616622type Condition schema relations grouping params =
617623 Expression schema relations grouping params ('NotNull 'PGbool)
618624
619−-- | >>> renderExpression true
620−-- "TRUE"
625+-- | >>> printSQL true
626+-- TRUE
621627true :: Condition schema relations grouping params
622628true = UnsafeExpression "TRUE"
623629
624−-- | >>> renderExpression false
625−-- "FALSE"
630+-- | >>> printSQL false
631+-- FALSE
626632false :: Condition schema relations grouping params
627633false = UnsafeExpression "FALSE"
628634
629−-- | >>> renderExpression $ not_ true
630−-- "(NOT TRUE)"
635+-- | >>> printSQL $ not_ true
636+-- (NOT TRUE)
631637not_
632638 :: Condition schema relations grouping params
633639 -> Condition schema relations grouping params
634640not_ = unsafeUnaryOp "NOT"
635641
636−-- | >>> renderExpression $ true .&& false
637−-- "(TRUE AND FALSE)"
642+-- | >>> printSQL $ true .&& false
643+-- (TRUE AND FALSE)
638644(.&&)
639645 :: Condition schema relations grouping params
640646 -> Condition schema relations grouping params
641647 -> Condition schema relations grouping params
642648(.&&) = unsafeBinaryOp "AND"
643649
644−-- | >>> renderExpression $ true .|| false
645−-- "(TRUE OR FALSE)"
650+-- | >>> printSQL $ true .|| false
651+-- (TRUE OR FALSE)
646652(.||)
647653 :: Condition schema relations grouping params
648654 -> Condition schema relations grouping params
@@ -653,9 +659,9 @@ not_ = unsafeUnaryOp "NOT"
653659-- let
654660-- expression :: Expression schema relations grouping params (nullity 'PGint2)
655661-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
656−-- in renderExpression expression
662+-- in printSQL expression
657663-- :}
658−-- "CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END"
664+-- CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END
659665caseWhenThenElse
660666 :: [ ( Condition schema relations grouping params
661667 , Expression schema relations grouping params (ty)
@@ -681,9 +687,9 @@ caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
681687-- let
682688-- expression :: Expression schema relations grouping params (nullity 'PGint2)
683689-- expression = ifThenElse true 1 0
684−-- in renderExpression expression
690+-- in printSQL expression
685691-- :}
686−-- "CASE WHEN TRUE THEN 1 ELSE 0 END"
692+-- CASE WHEN TRUE THEN 1 ELSE 0 END
687693ifThenElse
688694 :: Condition schema relations grouping params
689695 -> Expression schema relations grouping params (ty) -- ^ then
@@ -694,8 +700,8 @@ ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
694700-- | Comparison operations like `.==`, `./=`, `.>`, `.>=`, `.<` and `.<=`
695701-- will produce @NULL@s if one of their arguments is @NULL@.
696702--
697−-- >>> renderExpression $ notNull true .== null_
698−-- "(TRUE = NULL)"
703+-- >>> printSQL $ notNull true .== null_
704+-- (TRUE = NULL)
699705(.==)
700706 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
701707 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -703,8 +709,8 @@ ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
703709(.==) = unsafeBinaryOp "="
704710infix 4 .==
705711
706−-- | >>> renderExpression $ notNull true ./= null_
707−-- "(TRUE <> NULL)"
712+-- | >>> printSQL $ notNull true ./= null_
713+-- (TRUE <> NULL)
708714(./=)
709715 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
710716 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -712,8 +718,8 @@ infix 4 .==
712718(./=) = unsafeBinaryOp "<>"
713719infix 4 ./=
714720
715−-- | >>> renderExpression $ notNull true .>= null_
716−-- "(TRUE >= NULL)"
721+-- | >>> printSQL $ notNull true .>= null_
722+-- (TRUE >= NULL)
717723(.>=)
718724 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
719725 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -721,8 +727,8 @@ infix 4 ./=
721727(.>=) = unsafeBinaryOp ">="
722728infix 4 .>=
723729
724−-- | >>> renderExpression $ notNull true .< null_
725−-- "(TRUE < NULL)"
730+-- | >>> printSQL $ notNull true .< null_
731+-- (TRUE < NULL)
726732(.<)
727733 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
728734 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -730,8 +736,8 @@ infix 4 .>=
730736(.<) = unsafeBinaryOp "<"
731737infix 4 .<
732738
733−-- | >>> renderExpression $ notNull true .<= null_
734−-- "(TRUE <= NULL)"
739+-- | >>> printSQL $ notNull true .<= null_
740+-- (TRUE <= NULL)
735741(.<=)
736742 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
737743 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -739,8 +745,8 @@ infix 4 .<
739745(.<=) = unsafeBinaryOp "<="
740746infix 4 .<=
741747
742−-- | >>> renderExpression $ notNull true .> null_
743−-- "(TRUE > NULL)"
748+-- | >>> printSQL $ notNull true .> null_
749+-- (TRUE > NULL)
744750(.>)
745751 :: Expression schema relations grouping params (nullity ty) -- ^ lhs
746752 -> Expression schema relations grouping params (nullity ty) -- ^ rhs
@@ -748,32 +754,32 @@ infix 4 .<=
748754(.>) = unsafeBinaryOp ">"
749755infix 4 .>
750756
751−-- | >>> renderExpression currentDate
752−-- "CURRENT_DATE"
757+-- | >>> printSQL currentDate
758+-- CURRENT_DATE
753759currentDate
754760 :: Expression schema relations grouping params (nullity 'PGdate)
755761currentDate = UnsafeExpression "CURRENT_DATE"
756762
757−-- | >>> renderExpression currentTime
758−-- "CURRENT_TIME"
763+-- | >>> printSQL currentTime
764+-- CURRENT_TIME
759765currentTime
760766 :: Expression schema relations grouping params (nullity 'PGtimetz)
761767currentTime = UnsafeExpression "CURRENT_TIME"
762768
763−-- | >>> renderExpression currentTimestamp
764−-- "CURRENT_TIMESTAMP"
769+-- | >>> printSQL currentTimestamp
770+-- CURRENT_TIMESTAMP
765771currentTimestamp
766772 :: Expression schema relations grouping params (nullity 'PGtimestamptz)
767773currentTimestamp = UnsafeExpression "CURRENT_TIMESTAMP"
768774
769−-- | >>> renderExpression localTime
770−-- "LOCALTIME"
775+-- | >>> printSQL localTime
776+-- LOCALTIME
771777localTime
772778 :: Expression schema relations grouping params (nullity 'PGtime)
773779localTime = UnsafeExpression "LOCALTIME"
774780
775−-- | >>> renderExpression localTimestamp
776−-- "LOCALTIMESTAMP"
781+-- | >>> printSQL localTimestamp
782+-- LOCALTIMESTAMP
777783localTimestamp
778784 :: Expression schema relations grouping params (nullity 'PGtimestamp)
779785localTimestamp = UnsafeExpression "LOCALTIMESTAMP"
@@ -807,24 +813,24 @@ instance Monoid
807813 mempty = fromString ""
808814 mappend = (<>)
809815
810−-- | >>> renderExpression $ lower "ARRRGGG"
811−-- "lower(E'ARRRGGG')"
816+-- | >>> printSQL $ lower "ARRRGGG"
817+-- lower(E'ARRRGGG')
812818lower
813819 :: Expression schema relations grouping params (nullity 'PGtext)
814820 -- ^ string to lower case
815821 -> Expression schema relations grouping params (nullity 'PGtext)
816822lower = unsafeFunction "lower"
817823
818−-- | >>> renderExpression $ upper "eeee"
819−-- "upper(E'eeee')"
824+-- | >>> printSQL $ upper "eeee"
825+-- upper(E'eeee')
820826upper
821827 :: Expression schema relations grouping params (nullity 'PGtext)
822828 -- ^ string to upper case
823829 -> Expression schema relations grouping params (nullity 'PGtext)
824830upper = unsafeFunction "upper"
825831
826−-- | >>> renderExpression $ charLength "four"
827−-- "char_length(E'four')"
832+-- | >>> printSQL $ charLength "four"
833+-- char_length(E'four')
828834charLength
829835 :: Expression schema relations grouping params (nullity 'PGtext)
830836 -- ^ string to measure
@@ -838,8 +844,8 @@ charLength = unsafeFunction "char_length"
838844-- in pattern stands for (matches) any single character; a percent sign (%)
839845-- matches any sequence of zero or more characters.
840846--
841−-- >>> renderExpression $ "abc" `like` "a%"
842−-- "(E'abc' LIKE E'a%')"
847+-- >>> printSQL $ "abc" `like` "a%"
848+-- (E'abc' LIKE E'a%')
843849like
844850 :: Expression schema relations grouping params (nullity 'PGtext)
845851 -- ^ string
@@ -872,9 +878,9 @@ unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
872878-- let
873879-- expression :: Expression schema '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('Grouped bys) params ('Null 'PGnumeric)
874880-- expression = sum_ #col
875−-- in renderExpression expression
881+-- in printSQL expression
876882-- :}
877−-- "sum(\"col\")"
883+-- sum("col")
878884sum_
879885 :: PGNum ty
880886 => Expression schema relations 'Ungrouped params (nullity ty)
@@ -886,9 +892,9 @@ sum_ = unsafeAggregate "sum"
886892-- let
887893-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGnumeric]] ('Grouped bys) params (nullity 'PGnumeric)
888894-- expression = sumDistinct #col
889−-- in renderExpression expression
895+-- in printSQL expression
890896-- :}
891−-- "sum(DISTINCT \"col\")"
897+-- sum(DISTINCT "col")
892898sumDistinct
893899 :: PGNum ty
894900 => Expression schema relations 'Ungrouped params (nullity ty)
@@ -917,9 +923,9 @@ instance PGAvg 'PGinterval 'PGinterval
917923-- let
918924-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4)
919925-- expression = bitAnd #col
920−-- in renderExpression expression
926+-- in printSQL expression
921927-- :}
922−-- "bit_and(\"col\")"
928+-- bit_and("col")
923929bitAnd
924930 :: PGIntegral int
925931 => Expression schema relations 'Ungrouped params (nullity int)
@@ -931,9 +937,9 @@ bitAnd = unsafeAggregate "bit_and"
931937-- let
932938-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4)
933939-- expression = bitOr #col
934−-- in renderExpression expression
940+-- in printSQL expression
935941-- :}
936−-- "bit_or(\"col\")"
942+-- bit_or("col")
937943bitOr
938944 :: PGIntegral int
939945 => Expression schema relations 'Ungrouped params (nullity int)
@@ -945,9 +951,9 @@ bitOr = unsafeAggregate "bit_or"
945951-- let
946952-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4)
947953-- expression = bitAndDistinct #col
948−-- in renderExpression expression
954+-- in printSQL expression
949955-- :}
950−-- "bit_and(DISTINCT \"col\")"
956+-- bit_and(DISTINCT "col")
951957bitAndDistinct
952958 :: PGIntegral int
953959 => Expression schema relations 'Ungrouped params (nullity int)
@@ -959,9 +965,9 @@ bitAndDistinct = unsafeAggregateDistinct "bit_and"
959965-- let
960966-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4)
961967-- expression = bitOrDistinct #col
962−-- in renderExpression expression
968+-- in printSQL expression
963969-- :}
964−-- "bit_or(DISTINCT \"col\")"
970+-- bit_or(DISTINCT "col")
965971bitOrDistinct
966972 :: PGIntegral int
967973 => Expression schema relations 'Ungrouped params (nullity int)
@@ -973,9 +979,9 @@ bitOrDistinct = unsafeAggregateDistinct "bit_or"
973979-- let
974980-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
975981-- expression = boolAnd #col
976−-- in renderExpression expression
982+-- in printSQL expression
977983-- :}
978−-- "bool_and(\"col\")"
984+-- bool_and("col")
979985boolAnd
980986 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
981987 -- ^ what to aggregate
@@ -986,9 +992,9 @@ boolAnd = unsafeAggregate "bool_and"
986992-- let
987993-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
988994-- expression = boolOr #col
989−-- in renderExpression expression
995+-- in printSQL expression
990996-- :}
991−-- "bool_or(\"col\")"
997+-- bool_or("col")
992998boolOr
993999 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
9941000 -- ^ what to aggregate
@@ -999,9 +1005,9 @@ boolOr = unsafeAggregate "bool_or"
9991005-- let
10001006-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
10011007-- expression = boolAndDistinct #col
1002−-- in renderExpression expression
1008+-- in printSQL expression
10031009-- :}
1004−-- "bool_and(DISTINCT \"col\")"
1010+-- bool_and(DISTINCT "col")
10051011boolAndDistinct
10061012 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
10071013 -- ^ what to aggregate
@@ -1012,9 +1018,9 @@ boolAndDistinct = unsafeAggregateDistinct "bool_and"
10121018-- let
10131019-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
10141020-- expression = boolOrDistinct #col
1015−-- in renderExpression expression
1021+-- in printSQL expression
10161022-- :}
1017−-- "bool_or(DISTINCT \"col\")"
1023+-- bool_or(DISTINCT "col")
10181024boolOrDistinct
10191025 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
10201026 -- ^ what to aggregate
@@ -1023,8 +1029,8 @@ boolOrDistinct = unsafeAggregateDistinct "bool_or"
10231029
10241030-- | A special aggregation that does not require an input
10251031--
1026−-- >>> renderExpression countStar
1027−-- "count(*)"
1032+-- >>> printSQL countStar
1033+-- count(*)
10281034countStar
10291035 :: Expression schema relations ('Grouped bys) params ('NotNull 'PGint8)
10301036countStar = UnsafeExpression $ "count(*)"
@@ -1033,9 +1039,9 @@ countStar = UnsafeExpression $ "count(*)"
10331039-- let
10341040-- expression :: Expression schema '[tab ::: '["col" ::: nullity ty]] (Grouped bys) params ('NotNull 'PGint8)
10351041-- expression = count #col
1036−-- in renderExpression expression
1042+-- in printSQL expression
10371043-- :}
1038−-- "count(\"col\")"
1044+-- count("col")
10391045count
10401046 :: Expression schema relations 'Ungrouped params ty
10411047 -- ^ what to count
@@ -1046,9 +1052,9 @@ count = unsafeAggregate "count"
10461052-- let
10471053-- expression :: Expression schema '[tab ::: '["col" ::: nullity ty]] (Grouped bys) params ('NotNull 'PGint8)
10481054-- expression = countDistinct #col
1049−-- in renderExpression expression
1055+-- in printSQL expression
10501056-- :}
1051−-- "count(DISTINCT \"col\")"
1057+-- count(DISTINCT "col")
10521058countDistinct
10531059 :: Expression schema relations 'Ungrouped params ty
10541060 -- ^ what to count
@@ -1061,9 +1067,9 @@ countDistinct = unsafeAggregateDistinct "count"
10611067-- let
10621068-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
10631069-- expression = every #col
1064−-- in renderExpression expression
1070+-- in printSQL expression
10651071-- :}
1066−-- "every(\"col\")"
1072+-- every("col")
10671073every
10681074 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
10691075 -- ^ what to aggregate
@@ -1076,9 +1082,9 @@ every = unsafeAggregate "every"
10761082-- let
10771083-- expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool)
10781084-- expression = everyDistinct #col
1079−-- in renderExpression expression
1085+-- in printSQL expression
10801086-- :}
1081−-- "every(DISTINCT \"col\")"
1087+-- every(DISTINCT "col")
10821088everyDistinct
10831089 :: Expression schema relations 'Ungrouped params (nullity 'PGbool)
10841090 -- ^ what to aggregate