on dev help sign in
change Grouping location
commit96360bfb24245c43855859905ba8e692d66d0c7d authorEitan Chatav <eitan.chatav@gmail.com> dateThu 17 Jan 2019, 10:37 (8 years ago) parent3294fdd
4 files changed+520−520
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+3−3 squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+334−334 squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+36−36 squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+147−147
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+3−3
@@ -298,7 +298,7 @@ check
298298 , HasAll aliases (TableToRow table) subcolumns )
299299 => NP Alias aliases
300300 -- ^ specify the subcolumns which are getting checked
301− -> (forall t. Condition '[] schemas '[] 'Ungrouped '[t ::: subcolumns])
301+ -> (forall t. Condition 'Ungrouped '[] schemas '[] '[t ::: subcolumns])
302302 -- ^ a closed `Condition` on those subcolumns
303303 -> TableConstraintExpression sch tab schemas ('Check aliases)
304304check _cols condition = UnsafeTableConstraintExpression $
@@ -759,7 +759,7 @@ newtype AlterColumn (schemas :: SchemasType) (ty0 :: ColumnType) (ty1 :: ColumnT
759759-- :}
760760-- ALTER TABLE "tab" ALTER COLUMN "col" SET DEFAULT 5;
761761setDefault
762− :: Expression '[] schemas '[] 'Ungrouped '[] ty -- ^ default value to set
762+ :: Expression 'Ungrouped '[] schemas '[] '[] ty -- ^ default value to set
763763 -> AlterColumn schemas (constraint :=> ty) ('Def :=> ty)
764764setDefault expression = UnsafeAlterColumn $
765765 "SET DEFAULT" <+> renderExpression expression
@@ -1010,7 +1010,7 @@ notNullable ty = UnsafeColumnTypeExpression $ renderSQL ty <+> "NOT NULL"
10101010
10111011-- | used in `createTable` commands as a column constraint to give a default
10121012default_
1013− :: Expression '[] schemas '[] 'Ungrouped '[] ty
1013+ :: Expression 'Ungrouped '[] schemas '[] '[] ty
10141014 -> ColumnTypeExpression schemas ('NoDef :=> ty)
10151015 -> ColumnTypeExpression schemas ('Def :=> ty)
10161016default_ x ty = UnsafeColumnTypeExpression $
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+334−334
@@ -239,16 +239,16 @@ values from primitive expression using arithmetic, logical,
239239and other operations.
240240-}
241241newtype Expression
242+ (grp :: Grouping)
242243 (commons :: FromType)
243244 (schemas :: SchemasType)
244245 (params :: [NullityType])
245− (grp :: Grouping)
246246 (from :: FromType)
247247 (ty :: NullityType)
248248 = UnsafeExpression { renderExpression :: ByteString }
249249 deriving (GHC.Generic,Show,Eq,Ord,NFData)
250250
251−instance RenderSQL (Expression commons schemas params grp from ty) where
251+instance RenderSQL (Expression grp commons schemas params from ty) where
252252 renderSQL = renderExpression
253253
254254{- | A `HasParameter` constraint is used to indicate a value that is
@@ -271,7 +271,7 @@ class KnownNat n => HasParameter
271271 -- ($1 :: int4)
272272 parameter
273273 :: TypeExpression schemas ty
274− -> Expression commons schemas params grp from ty
274+ -> Expression grp commons schemas params from ty
275275 parameter ty = UnsafeExpression $ parenthesized $
276276 "$" <> renderNat @n <+> "::"
277277 <+> renderSQL ty
@@ -288,32 +288,32 @@ instance {-# OVERLAPPABLE #-} (KnownNat n, HasParameter (n-1) params ty)
288288param
289289 :: forall n commons schemas params from grp ty
290290 . (PGTyped schemas ty, HasParameter n params ty)
291− => Expression commons schemas params grp from ty -- ^ param
291+ => Expression grp commons schemas params from ty -- ^ param
292292param = parameter @n (pgtype @schemas)
293293
294294instance (HasUnique tab from row, Has col row ty)
295− => IsLabel col (Expression commons schemas params 'Ungrouped from ty) where
295+ => IsLabel col (Expression 'Ungrouped commons schemas params from ty) where
296296 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
297297instance (HasUnique tab from row, Has col row ty, column ~ (col ::: ty))
298298 => IsLabel col
299− (Aliased (Expression commons schemas params 'Ungrouped from) column) where
299+ (Aliased (Expression 'Ungrouped commons schemas params from) column) where
300300 fromLabel = fromLabel @col `As` Alias
301301instance (HasUnique tab from row, Has col row ty, columns ~ '[col ::: ty])
302302 => IsLabel col
303− (NP (Aliased (Expression commons schemas params 'Ungrouped from)) columns) where
303+ (NP (Aliased (Expression 'Ungrouped commons schemas params from)) columns) where
304304 fromLabel = fromLabel @col :* Nil
305305
306306instance (Has tab from row, Has col row ty)
307− => IsQualified tab col (Expression commons schemas params 'Ungrouped from ty) where
307+ => IsQualified tab col (Expression 'Ungrouped commons schemas params from ty) where
308308 tab ! col = UnsafeExpression $
309309 renderSQL tab <> "." <> renderSQL col
310310instance (Has tab from row, Has col row ty, column ~ (col ::: ty))
311311 => IsQualified tab col
312− (Aliased (Expression commons schemas params 'Ungrouped from) column) where
312+ (Aliased (Expression 'Ungrouped commons schemas params from) column) where
313313 tab ! col = tab ! col `As` col
314314instance (Has tab from row, Has col row ty, columns ~ '[col ::: ty])
315315 => IsQualified tab col
316− (NP (Aliased (Expression commons schemas params 'Ungrouped from)) columns) where
316+ (NP (Aliased (Expression 'Ungrouped commons schemas params from)) columns) where
317317 tab ! col = tab ! col :* Nil
318318
319319instance
@@ -321,7 +321,7 @@ instance
321321 , Has col row ty
322322 , GroupedBy tab col bys
323323 ) => IsLabel col
324− (Expression commons schemas params ('Grouped bys) from ty) where
324+ (Expression ('Grouped bys) commons schemas params from ty) where
325325 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
326326instance
327327 ( HasUnique tab from row
@@ -329,7 +329,7 @@ instance
329329 , GroupedBy tab col bys
330330 , column ~ (col ::: ty)
331331 ) => IsLabel col
332− (Aliased (Expression commons schemas params ('Grouped bys) from) column) where
332+ (Aliased (Expression ('Grouped bys) commons schemas params from) column) where
333333 fromLabel = fromLabel @col `As` Alias
334334instance
335335 ( HasUnique tab from row
@@ -337,7 +337,7 @@ instance
337337 , GroupedBy tab col bys
338338 , columns ~ '[col ::: ty]
339339 ) => IsLabel col
340− (NP (Aliased (Expression commons schemas params ('Grouped bys) from)) columns) where
340+ (NP (Aliased (Expression ('Grouped bys) commons schemas params from)) columns) where
341341 fromLabel = fromLabel @col :* Nil
342342
343343instance
@@ -345,7 +345,7 @@ instance
345345 , Has col row ty
346346 , GroupedBy tab col bys
347347 ) => IsQualified tab col
348− (Expression commons schemas params ('Grouped bys) from ty) where
348+ (Expression ('Grouped bys) commons schemas params from ty) where
349349 tab ! col = UnsafeExpression $
350350 renderSQL tab <> "." <> renderSQL col
351351instance
@@ -354,7 +354,7 @@ instance
354354 , GroupedBy tab col bys
355355 , column ~ (col ::: ty)
356356 ) => IsQualified tab col
357− (Aliased (Expression commons schemas params ('Grouped bys) from) column) where
357+ (Aliased (Expression ('Grouped bys) commons schemas params from) column) where
358358 tab ! col = tab ! col `As` col
359359instance
360360 ( Has tab from row
@@ -362,7 +362,7 @@ instance
362362 , GroupedBy tab col bys
363363 , columns ~ '[col ::: ty]
364364 ) => IsQualified tab col
365− (NP (Aliased (Expression commons schemas params ('Grouped bys) from)) columns) where
365+ (NP (Aliased (Expression ('Grouped bys) commons schemas params from)) columns) where
366366 tab ! col = tab ! col :* Nil
367367
368368-- | analagous to `Nothing`
@@ -386,11 +386,11 @@ notNull = UnsafeExpression . renderSQL
386386-- >>> printSQL $ coalesce [null_, true] false
387387-- COALESCE(NULL, TRUE, FALSE)
388388coalesce
389− :: [Expression commons schemas params grp from ('Null ty)]
389+ :: [Expression grp commons schemas params from ('Null ty)]
390390 -- ^ @NULL@s may be present
391− -> Expression commons schemas params grp from ('NotNull ty)
391+ -> Expression grp commons schemas params from ('NotNull ty)
392392 -- ^ @NULL@ is absent
393− -> Expression commons schemas params grp from ('NotNull ty)
393+ -> Expression grp commons schemas params from ('NotNull ty)
394394coalesce nullxs notNullx = UnsafeExpression $
395395 "COALESCE" <> parenthesized (commaSeparated
396396 ((renderSQL <$> nullxs) <> [renderSQL notNullx]))
@@ -400,26 +400,26 @@ coalesce nullxs notNullx = UnsafeExpression $
400400-- >>> printSQL $ fromNull true null_
401401-- COALESCE(NULL, TRUE)
402402fromNull
403− :: Expression commons schemas params grp from ('NotNull ty)
403+ :: Expression grp commons schemas params from ('NotNull ty)
404404 -- ^ what to convert @NULL@ to
405− -> Expression commons schemas params grp from ('Null ty)
406− -> Expression commons schemas params grp from ('NotNull ty)
405+ -> Expression grp commons schemas params from ('Null ty)
406+ -> Expression grp commons schemas params from ('NotNull ty)
407407fromNull notNullx nullx = coalesce [nullx] notNullx
408408
409409-- | >>> printSQL $ null_ & isNull
410410-- NULL IS NULL
411411isNull
412− :: Expression commons schemas params grp from ('Null ty)
412+ :: Expression grp commons schemas params from ('Null ty)
413413 -- ^ possibly @NULL@
414− -> Condition commons schemas params grp from
414+ -> Condition grp commons schemas params from
415415isNull x = UnsafeExpression $ renderSQL x <+> "IS NULL"
416416
417417-- | >>> printSQL $ null_ & isNotNull
418418-- NULL IS NOT NULL
419419isNotNull
420− :: Expression commons schemas params grp from ('Null ty)
420+ :: Expression grp commons schemas params from ('Null ty)
421421 -- ^ possibly @NULL@
422− -> Condition commons schemas params grp from
422+ -> Condition grp commons schemas params from
423423isNotNull x = UnsafeExpression $ renderSQL x <+> "IS NOT NULL"
424424
425425-- | analagous to `maybe` using @IS NULL@
@@ -427,13 +427,13 @@ isNotNull x = UnsafeExpression $ renderSQL x <+> "IS NOT NULL"
427427-- >>> printSQL $ matchNull true not_ null_
428428-- CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END
429429matchNull
430− :: Expression commons schemas params grp from (nullty)
430+ :: Expression grp commons schemas params from (nullty)
431431 -- ^ what to convert @NULL@ to
432− -> ( Expression commons schemas params grp from ('NotNull ty)
433− -> Expression commons schemas params grp from (nullty) )
432+ -> ( Expression grp commons schemas params from ('NotNull ty)
433+ -> Expression grp commons schemas params from (nullty) )
434434 -- ^ function to perform when @NULL@ is absent
435− -> Expression commons schemas params grp from ('Null ty)
436− -> Expression commons schemas params grp from (nullty)
435+ -> Expression grp commons schemas params from ('Null ty)
436+ -> Expression grp commons schemas params from (nullty)
437437matchNull y f x = ifThenElse (isNull x) y
438438 (f (UnsafeExpression (renderSQL x)))
439439
@@ -446,20 +446,20 @@ matchNull y f x = ifThenElse (isNull x) y
446446NULL IF (FALSE, ($1 :: bool))
447447-}
448448nullIf
449− :: Expression commons schemas params grp from ('NotNull ty)
449+ :: Expression grp commons schemas params from ('NotNull ty)
450450 -- ^ @NULL@ is absent
451− -> Expression commons schemas params grp from ('NotNull ty)
451+ -> Expression grp commons schemas params from ('NotNull ty)
452452 -- ^ @NULL@ is absent
453− -> Expression commons schemas params grp from ('Null ty)
453+ -> Expression grp commons schemas params from ('Null ty)
454454nullIf x y = UnsafeExpression $ "NULL IF" <+> parenthesized
455455 (renderSQL x <> ", " <> renderSQL y)
456456
457457-- | >>> printSQL $ array [null_, false, true]
458458-- ARRAY[NULL, FALSE, TRUE]
459459array
460− :: [Expression commons schemas params grp from ty]
460+ :: [Expression grp commons schemas params from ty]
461461 -- ^ array elements
462− -> Expression commons schemas params grp from (nullity ('PGvararray ty))
462+ -> Expression grp commons schemas params from (nullity ('PGvararray ty))
463463array xs = UnsafeExpression $
464464 "ARRAY[" <> commaSeparated (renderSQL <$> xs) <> "]"
465465
@@ -467,13 +467,13 @@ array xs = UnsafeExpression $
467467-- (ARRAY[NULL, FALSE, TRUE])[2]
468468index
469469 :: Word64 -- ^ index
470− -> Expression commons schemas params grp from (nullity ('PGvararray ty)) -- ^ array
471− -> Expression commons schemas params grp from (NullifyType ty)
470+ -> Expression grp commons schemas params from (nullity ('PGvararray ty)) -- ^ array
471+ -> Expression grp commons schemas params from (NullifyType ty)
472472index n expr = UnsafeExpression $
473473 parenthesized (renderSQL expr) <> "[" <> fromString (show n) <> "]"
474474
475475instance (KnownSymbol label, label `In` labels) => IsPGlabel label
476− (Expression commons schemas params grp from (nullity ('PGenum labels))) where
476+ (Expression grp commons schemas params from (nullity ('PGenum labels))) where
477477 label = UnsafeExpression $ renderSQL (PGlabel @label)
478478
479479-- | A row constructor is an expression that builds a row value
@@ -485,14 +485,14 @@ instance (KnownSymbol label, label `In` labels) => IsPGlabel label
485485-- , "imaginary" ::: 'NotNull 'PGfloat8 ]
486486-- :}
487487--
488−-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression commons schemas from grp params ('NotNull Complex)
488+-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression grp commons schemas params from ('NotNull Complex)
489489-- >>> printSQL i
490490-- ROW(0, 1)
491491row
492492 :: SListI row
493− => NP (Aliased (Expression commons schemas params grp from)) row
493+ => NP (Aliased (Expression grp commons schemas params from)) row
494494 -- ^ zero or more expressions for the row field values
495− -> Expression commons schemas params grp from (nullity ('PGcomposite row))
495+ -> Expression grp commons schemas params from (nullity ('PGcomposite row))
496496row exprs = UnsafeExpression $ "ROW" <> parenthesized
497497 (renderCommaSeparated (\ (expr `As` _) -> renderSQL expr) exprs)
498498
@@ -512,18 +512,18 @@ field
512512 , Has field row ty)
513513 => QualifiedAlias sch tydef -- ^ row type
514514 -> Alias field -- ^ field name
515− -> Expression commons schemas params grp from ('NotNull ('PGcomposite row))
516− -> Expression commons schemas params grp from ty
515+ -> Expression grp commons schemas params from ('NotNull ('PGcomposite row))
516+ -> Expression grp commons schemas params from ty
517517field td fld expr = UnsafeExpression $
518518 parenthesized (renderSQL expr <> "::" <> renderSQL td)
519519 <> "." <> renderSQL fld
520520
521521instance Semigroup
522− (Expression commons schemas params grp from (nullity ('PGvararray ty))) where
522+ (Expression grp commons schemas params from (nullity ('PGvararray ty))) where
523523 (<>) = unsafeBinaryOp "||"
524524
525525instance Monoid
526− (Expression commons schemas params grp from (nullity ('PGvararray ty))) where
526+ (Expression grp commons schemas params from (nullity ('PGvararray ty))) where
527527 mempty = array []
528528 mappend = (<>)
529529
@@ -531,22 +531,22 @@ instance Monoid
531531-- >>> printSQL expr
532532-- GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))
533533greatest
534− :: Expression commons schemas params grp from (nullty)
534+ :: Expression grp commons schemas params from (nullty)
535535 -- ^ needs at least 1 argument
536− -> [Expression commons schemas params grp from (nullty)]
536+ -> [Expression grp commons schemas params from (nullty)]
537537 -- ^ or more
538− -> Expression commons schemas params grp from (nullty)
538+ -> Expression grp commons schemas params from (nullty)
539539greatest x xs = UnsafeExpression $ "GREATEST("
540540 <> commaSeparated (renderSQL <$> (x:xs)) <> ")"
541541
542542-- | >>> printSQL $ least currentTimestamp [null_]
543543-- LEAST(CURRENT_TIMESTAMP, NULL)
544544least
545− :: Expression commons schemas params grp from (nullty)
545+ :: Expression grp commons schemas params from (nullty)
546546 -- ^ needs at least 1 argument
547− -> [Expression commons schemas params grp from (nullty)]
547+ -> [Expression grp commons schemas params from (nullty)]
548548 -- ^ or more
549− -> Expression commons schemas params grp from (nullty)
549+ -> Expression grp commons schemas params from (nullty)
550550least x xs = UnsafeExpression $ "LEAST("
551551 <> commaSeparated (renderSQL <$> (x:xs)) <> ")"
552552
@@ -555,9 +555,9 @@ least x xs = UnsafeExpression $ "LEAST("
555555unsafeBinaryOp
556556 :: ByteString
557557 -- ^ operator
558− -> Expression commons schemas params grp from (ty0)
559− -> Expression commons schemas params grp from (ty1)
560− -> Expression commons schemas params grp from (ty2)
558+ -> Expression grp commons schemas params from (ty0)
559+ -> Expression grp commons schemas params from (ty1)
560+ -> Expression grp commons schemas params from (ty2)
561561unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
562562 renderSQL x <+> op <+> renderSQL y
563563
@@ -566,8 +566,8 @@ unsafeBinaryOp op x y = UnsafeExpression $ parenthesized $
566566unsafeUnaryOp
567567 :: ByteString
568568 -- ^ operator
569− -> Expression commons schemas params grp from (ty0)
570− -> Expression commons schemas params grp from (ty1)
569+ -> Expression grp commons schemas params from (ty0)
570+ -> Expression grp commons schemas params from (ty1)
571571unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
572572 op <+> renderSQL x
573573
@@ -576,8 +576,8 @@ unsafeUnaryOp op x = UnsafeExpression $ parenthesized $
576576unsafeFunction
577577 :: ByteString
578578 -- ^ function
579− -> Expression commons schemas params grp from (xty)
580− -> Expression commons schemas params grp from (yty)
579+ -> Expression grp commons schemas params from (xty)
580+ -> Expression grp commons schemas params from (yty)
581581unsafeFunction fun x = UnsafeExpression $
582582 fun <> parenthesized (renderSQL x)
583583
@@ -586,13 +586,13 @@ unsafeVariadicFunction
586586 :: SListI elems
587587 => ByteString
588588 -- ^ function
589− -> NP (Expression commons schemas params grp from) elems
590− -> Expression commons schemas params grp from ret
589+ -> NP (Expression grp commons schemas params from) elems
590+ -> Expression grp commons schemas params from ret
591591unsafeVariadicFunction fun x = UnsafeExpression $
592592 fun <> parenthesized (commaSeparated (hcollapse (hmap (K . renderSQL) x)))
593593
594594instance ty `In` PGNum
595− => Num (Expression commons schemas params grp from (nullity ty)) where
595+ => Num (Expression grp commons schemas params from (nullity ty)) where
596596 (+) = unsafeBinaryOp "+"
597597 (-) = unsafeBinaryOp "-"
598598 (*) = unsafeBinaryOp "*"
@@ -604,12 +604,12 @@ instance ty `In` PGNum
604604 . show
605605
606606instance (ty `In` PGNum, ty `In` PGFloating) => Fractional
607− (Expression commons schemas params grp from (nullity ty)) where
607+ (Expression grp commons schemas params from (nullity ty)) where
608608 (/) = unsafeBinaryOp "/"
609609 fromRational x = fromInteger (numerator x) / fromInteger (denominator x)
610610
611611instance (ty `In` PGNum, ty `In` PGFloating) => Floating
612− (Expression commons schemas params grp from (nullity ty)) where
612+ (Expression grp commons schemas params from (nullity ty)) where
613613 pi = UnsafeExpression "pi()"
614614 exp = unsafeFunction "exp"
615615 log = unsafeFunction "ln"
@@ -632,18 +632,18 @@ instance (ty `In` PGNum, ty `In` PGFloating) => Floating
632632
633633-- | >>> :{
634634-- let
635−-- expression :: Expression commons schemas params grp from (nullity 'PGfloat4)
635+-- expression :: Expression grp commons schemas params from (nullity 'PGfloat4)
636636-- expression = atan2_ pi 2
637637-- in printSQL expression
638638-- :}
639639-- atan2(pi(), 2)
640640atan2_
641641 :: float `In` PGFloating
642− => Expression commons schemas params grp from (nullity float)
642+ => Expression grp commons schemas params from (nullity float)
643643 -- ^ numerator
644− -> Expression commons schemas params grp from (nullity float)
644+ -> Expression grp commons schemas params from (nullity float)
645645 -- ^ denominator
646− -> Expression commons schemas params grp from (nullity float)
646+ -> Expression grp commons schemas params from (nullity float)
647647atan2_ y x = UnsafeExpression $
648648 "atan2(" <> renderSQL y <> ", " <> renderSQL x <> ")"
649649
@@ -656,9 +656,9 @@ atan2_ y x = UnsafeExpression $
656656cast
657657 :: TypeExpression schemas ty1
658658 -- ^ type to cast as
659− -> Expression commons schemas params grp from ty0
659+ -> Expression grp commons schemas params from ty0
660660 -- ^ value to convert
661− -> Expression commons schemas params grp from ty1
661+ -> Expression grp commons schemas params from ty1
662662cast ty x = UnsafeExpression $ parenthesized $
663663 renderSQL x <+> "::" <+> renderSQL ty
664664
@@ -666,136 +666,136 @@ cast ty x = UnsafeExpression $ parenthesized $
666666--
667667-- >>> :{
668668-- let
669−-- expression :: Expression commons schemas params grp from (nullity 'PGint2)
669+-- expression :: Expression grp commons schemas params from (nullity 'PGint2)
670670-- expression = 5 `quot_` 2
671671-- in printSQL expression
672672-- :}
673673-- (5 / 2)
674674quot_
675675 :: int `In` PGIntegral
676− => Expression commons schemas params grp from (nullity int)
676+ => Expression grp commons schemas params from (nullity int)
677677 -- ^ numerator
678− -> Expression commons schemas params grp from (nullity int)
678+ -> Expression grp commons schemas params from (nullity int)
679679 -- ^ denominator
680− -> Expression commons schemas params grp from (nullity int)
680+ -> Expression grp commons schemas params from (nullity int)
681681quot_ = unsafeBinaryOp "/"
682682
683683-- | remainder upon integer division
684684--
685685-- >>> :{
686686-- let
687−-- expression :: Expression commons schemas params grp from (nullity 'PGint2)
687+-- expression :: Expression grp commons schemas params from (nullity 'PGint2)
688688-- expression = 5 `rem_` 2
689689-- in printSQL expression
690690-- :}
691691-- (5 % 2)
692692rem_
693693 :: int `In` PGIntegral
694− => Expression commons schemas params grp from (nullity int)
694+ => Expression grp commons schemas params from (nullity int)
695695 -- ^ numerator
696− -> Expression commons schemas params grp from (nullity int)
696+ -> Expression grp commons schemas params from (nullity int)
697697 -- ^ denominator
698− -> Expression commons schemas params grp from (nullity int)
698+ -> Expression grp commons schemas params from (nullity int)
699699rem_ = unsafeBinaryOp "%"
700700
701701-- | >>> :{
702702-- let
703−-- expression :: Expression commons schemas params grp from (nullity 'PGfloat4)
703+-- expression :: Expression grp commons schemas params from (nullity 'PGfloat4)
704704-- expression = trunc pi
705705-- in printSQL expression
706706-- :}
707707-- trunc(pi())
708708trunc
709709 :: frac `In` PGFloating
710− => Expression commons schemas params grp from (nullity frac)
710+ => Expression grp commons schemas params from (nullity frac)
711711 -- ^ fractional number
712− -> Expression commons schemas params grp from (nullity frac)
712+ -> Expression grp commons schemas params from (nullity frac)
713713trunc = unsafeFunction "trunc"
714714
715715-- | >>> :{
716716-- let
717−-- expression :: Expression commons schemas params grp from (nullity 'PGfloat4)
717+-- expression :: Expression grp commons schemas params from (nullity 'PGfloat4)
718718-- expression = round_ pi
719719-- in printSQL expression
720720-- :}
721721-- round(pi())
722722round_
723723 :: frac `In` PGFloating
724− => Expression commons schemas params grp from (nullity frac)
724+ => Expression grp commons schemas params from (nullity frac)
725725 -- ^ fractional number
726− -> Expression commons schemas params grp from (nullity frac)
726+ -> Expression grp commons schemas params from (nullity frac)
727727round_ = unsafeFunction "round"
728728
729729-- | >>> :{
730730-- let
731−-- expression :: Expression commons schemas params grp from (nullity 'PGfloat4)
731+-- expression :: Expression grp commons schemas params from (nullity 'PGfloat4)
732732-- expression = ceiling_ pi
733733-- in printSQL expression
734734-- :}
735735-- ceiling(pi())
736736ceiling_
737737 :: frac `In` PGFloating
738− => Expression commons schemas params grp from (nullity frac)
738+ => Expression grp commons schemas params from (nullity frac)
739739 -- ^ fractional number
740− -> Expression commons schemas params grp from (nullity frac)
740+ -> Expression grp commons schemas params from (nullity frac)
741741ceiling_ = unsafeFunction "ceiling"
742742
743743-- | A `Condition` is an `Expression`, which can evaluate
744744-- to `true`, `false` or `null_`. This is because SQL uses
745745-- a three valued logic.
746−type Condition commons schemas params grp from =
747− Expression commons schemas params grp from ('Null 'PGbool)
746+type Condition grp commons schemas params from =
747+ Expression grp commons schemas params from ('Null 'PGbool)
748748
749749-- | >>> printSQL true
750750-- TRUE
751−true :: Expression commons schemas params grp from (nullity 'PGbool)
751+true :: Expression grp commons schemas params from (nullity 'PGbool)
752752true = UnsafeExpression "TRUE"
753753
754754-- | >>> printSQL false
755755-- FALSE
756−false :: Expression commons schemas params grp from (nullity 'PGbool)
756+false :: Expression grp commons schemas params from (nullity 'PGbool)
757757false = UnsafeExpression "FALSE"
758758
759759-- | >>> printSQL $ not_ true
760760-- (NOT TRUE)
761761not_
762− :: Expression commons schemas params grp from (nullity 'PGbool)
763− -> Expression commons schemas params grp from (nullity 'PGbool)
762+ :: Expression grp commons schemas params from (nullity 'PGbool)
763+ -> Expression grp commons schemas params from (nullity 'PGbool)
764764not_ = unsafeUnaryOp "NOT"
765765
766766-- | >>> printSQL $ true .&& false
767767-- (TRUE AND FALSE)
768768(.&&)
769− :: Expression commons schemas params grp from (nullity 'PGbool)
770− -> Expression commons schemas params grp from (nullity 'PGbool)
771− -> Expression commons schemas params grp from (nullity 'PGbool)
769+ :: Expression grp commons schemas params from (nullity 'PGbool)
770+ -> Expression grp commons schemas params from (nullity 'PGbool)
771+ -> Expression grp commons schemas params from (nullity 'PGbool)
772772infixr 3 .&&
773773(.&&) = unsafeBinaryOp "AND"
774774
775775-- | >>> printSQL $ true .|| false
776776-- (TRUE OR FALSE)
777777(.||)
778− :: Expression commons schemas params grp from (nullity 'PGbool)
779− -> Expression commons schemas params grp from (nullity 'PGbool)
780− -> Expression commons schemas params grp from (nullity 'PGbool)
778+ :: Expression grp commons schemas params from (nullity 'PGbool)
779+ -> Expression grp commons schemas params from (nullity 'PGbool)
780+ -> Expression grp commons schemas params from (nullity 'PGbool)
781781infixr 2 .||
782782(.||) = unsafeBinaryOp "OR"
783783
784784-- | >>> :{
785785-- let
786−-- expression :: Expression commons schemas params grp from (nullity 'PGint2)
786+-- expression :: Expression grp commons schemas params from (nullity 'PGint2)
787787-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
788788-- in printSQL expression
789789-- :}
790790-- CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END
791791caseWhenThenElse
792− :: [ ( Condition commons schemas params grp from
793− , Expression commons schemas params grp from ty
792+ :: [ ( Condition grp commons schemas params from
793+ , Expression grp commons schemas params from ty
794794 ) ]
795795 -- ^ whens and thens
796− -> Expression commons schemas params grp from ty
796+ -> Expression grp commons schemas params from ty
797797 -- ^ else
798− -> Expression commons schemas params grp from ty
798+ -> Expression grp commons schemas params from ty
799799caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
800800 [ "CASE"
801801 , mconcat
@@ -811,16 +811,16 @@ caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
811811
812812-- | >>> :{
813813-- let
814−-- expression :: Expression commons schemas params grp from (nullity 'PGint2)
814+-- expression :: Expression grp commons schemas params from (nullity 'PGint2)
815815-- expression = ifThenElse true 1 0
816816-- in printSQL expression
817817-- :}
818818-- CASE WHEN TRUE THEN 1 ELSE 0 END
819819ifThenElse
820− :: Condition commons schemas params grp from
821− -> Expression commons schemas params grp from ty -- ^ then
822− -> Expression commons schemas params grp from ty -- ^ else
823− -> Expression commons schemas params grp from ty
820+ :: Condition grp commons schemas params from
821+ -> Expression grp commons schemas params from ty -- ^ then
822+ -> Expression grp commons schemas params from ty -- ^ else
823+ -> Expression grp commons schemas params from ty
824824ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
825825
826826-- | Comparison operations like `.==`, `./=`, `.>`, `.>=`, `.<` and `.<=`
@@ -829,85 +829,85 @@ ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
829829-- >>> printSQL $ true .== null_
830830-- (TRUE = NULL)
831831(.==)
832− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
833− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
834− -> Condition commons schemas params grp from
832+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
833+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
834+ -> Condition grp commons schemas params from
835835(.==) = unsafeBinaryOp "="
836836infix 4 .==
837837
838838-- | >>> printSQL $ true ./= null_
839839-- (TRUE <> NULL)
840840(./=)
841− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
842− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
843− -> Condition commons schemas params grp from
841+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
842+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
843+ -> Condition grp commons schemas params from
844844(./=) = unsafeBinaryOp "<>"
845845infix 4 ./=
846846
847847-- | >>> printSQL $ true .>= null_
848848-- (TRUE >= NULL)
849849(.>=)
850− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
851− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
852− -> Condition commons schemas params grp from
850+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
851+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
852+ -> Condition grp commons schemas params from
853853(.>=) = unsafeBinaryOp ">="
854854infix 4 .>=
855855
856856-- | >>> printSQL $ true .< null_
857857-- (TRUE < NULL)
858858(.<)
859− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
860− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
861− -> Condition commons schemas params grp from
859+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
860+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
861+ -> Condition grp commons schemas params from
862862(.<) = unsafeBinaryOp "<"
863863infix 4 .<
864864
865865-- | >>> printSQL $ true .<= null_
866866-- (TRUE <= NULL)
867867(.<=)
868− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
869− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
870− -> Condition commons schemas params grp from
868+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
869+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
870+ -> Condition grp commons schemas params from
871871(.<=) = unsafeBinaryOp "<="
872872infix 4 .<=
873873
874874-- | >>> printSQL $ true .> null_
875875-- (TRUE > NULL)
876876(.>)
877− :: Expression commons schemas params grp from (nullity0 ty) -- ^ lhs
878− -> Expression commons schemas params grp from (nullity1 ty) -- ^ rhs
879− -> Condition commons schemas params grp from
877+ :: Expression grp commons schemas params from (nullity0 ty) -- ^ lhs
878+ -> Expression grp commons schemas params from (nullity1 ty) -- ^ rhs
879+ -> Condition grp commons schemas params from
880880(.>) = unsafeBinaryOp ">"
881881infix 4 .>
882882
883883-- | >>> printSQL currentDate
884884-- CURRENT_DATE
885885currentDate
886− :: Expression commons schemas params grp from (nullity 'PGdate)
886+ :: Expression grp commons schemas params from (nullity 'PGdate)
887887currentDate = UnsafeExpression "CURRENT_DATE"
888888
889889-- | >>> printSQL currentTime
890890-- CURRENT_TIME
891891currentTime
892− :: Expression commons schemas params grp from (nullity 'PGtimetz)
892+ :: Expression grp commons schemas params from (nullity 'PGtimetz)
893893currentTime = UnsafeExpression "CURRENT_TIME"
894894
895895-- | >>> printSQL currentTimestamp
896896-- CURRENT_TIMESTAMP
897897currentTimestamp
898− :: Expression commons schemas params grp from (nullity 'PGtimestamptz)
898+ :: Expression grp commons schemas params from (nullity 'PGtimestamptz)
899899currentTimestamp = UnsafeExpression "CURRENT_TIMESTAMP"
900900
901901-- | >>> printSQL localTime
902902-- LOCALTIME
903903localTime
904− :: Expression commons schemas params grp from (nullity 'PGtime)
904+ :: Expression grp commons schemas params from (nullity 'PGtime)
905905localTime = UnsafeExpression "LOCALTIME"
906906
907907-- | >>> printSQL localTimestamp
908908-- LOCALTIMESTAMP
909909localTimestamp
910− :: Expression commons schemas params grp from (nullity 'PGtimestamp)
910+ :: Expression grp commons schemas params from (nullity 'PGtimestamp)
911911localTimestamp = UnsafeExpression "LOCALTIMESTAMP"
912912
913913{-----------------------------------------
@@ -915,7 +915,7 @@ text
915915-----------------------------------------}
916916
917917instance IsString
918− (Expression commons schemas params grp from (nullity 'PGtext)) where
918+ (Expression grp commons schemas params from (nullity 'PGtext)) where
919919 fromString str = UnsafeExpression $
920920 "E\'" <> fromString (escape =<< str) <> "\'"
921921 where
@@ -931,36 +931,36 @@ instance IsString
931931 c -> [c]
932932
933933instance Semigroup
934− (Expression commons schemas params grp from (nullity 'PGtext)) where
934+ (Expression grp commons schemas params from (nullity 'PGtext)) where
935935 (<>) = unsafeBinaryOp "||"
936936
937937instance Monoid
938− (Expression commons schemas params grp from (nullity 'PGtext)) where
938+ (Expression grp commons schemas params from (nullity 'PGtext)) where
939939 mempty = fromString ""
940940 mappend = (<>)
941941
942942-- | >>> printSQL $ lower "ARRRGGG"
943943-- lower(E'ARRRGGG')
944944lower
945− :: Expression commons schemas params grp from (nullity 'PGtext)
945+ :: Expression grp commons schemas params from (nullity 'PGtext)
946946 -- ^ string to lower case
947− -> Expression commons schemas params grp from (nullity 'PGtext)
947+ -> Expression grp commons schemas params from (nullity 'PGtext)
948948lower = unsafeFunction "lower"
949949
950950-- | >>> printSQL $ upper "eeee"
951951-- upper(E'eeee')
952952upper
953− :: Expression commons schemas params grp from (nullity 'PGtext)
953+ :: Expression grp commons schemas params from (nullity 'PGtext)
954954 -- ^ string to upper case
955− -> Expression commons schemas params grp from (nullity 'PGtext)
955+ -> Expression grp commons schemas params from (nullity 'PGtext)
956956upper = unsafeFunction "upper"
957957
958958-- | >>> printSQL $ charLength "four"
959959-- char_length(E'four')
960960charLength
961− :: Expression commons schemas params grp from (nullity 'PGtext)
961+ :: Expression grp commons schemas params from (nullity 'PGtext)
962962 -- ^ string to measure
963− -> Expression commons schemas params grp from (nullity 'PGint4)
963+ -> Expression grp commons schemas params from (nullity 'PGint4)
964964charLength = unsafeFunction "char_length"
965965
966966-- | The `like` expression returns true if the @string@ matches
@@ -973,11 +973,11 @@ charLength = unsafeFunction "char_length"
973973-- >>> printSQL $ "abc" `like` "a%"
974974-- (E'abc' LIKE E'a%')
975975like
976− :: Expression commons schemas params grp from (nullity 'PGtext)
976+ :: Expression grp commons schemas params from (nullity 'PGtext)
977977 -- ^ string
978− -> Expression commons schemas params grp from (nullity 'PGtext)
978+ -> Expression grp commons schemas params from (nullity 'PGtext)
979979 -- ^ pattern
980− -> Expression commons schemas params grp from (nullity 'PGbool)
980+ -> Expression grp commons schemas params from (nullity 'PGbool)
981981like = unsafeBinaryOp "LIKE"
982982
983983-- | The key word ILIKE can be used instead of LIKE to make the
@@ -986,11 +986,11 @@ like = unsafeBinaryOp "LIKE"
986986-- >>> printSQL $ "abc" `ilike` "a%"
987987-- (E'abc' ILIKE E'a%')
988988ilike
989− :: Expression commons schemas params grp from (nullity 'PGtext)
989+ :: Expression grp commons schemas params from (nullity 'PGtext)
990990 -- ^ string
991− -> Expression commons schemas params grp from (nullity 'PGtext)
991+ -> Expression grp commons schemas params from (nullity 'PGtext)
992992 -- ^ pattern
993− -> Expression commons schemas params grp from (nullity 'PGbool)
993+ -> Expression grp commons schemas params from (nullity 'PGbool)
994994ilike = unsafeBinaryOp "ILIKE"
995995
996996{-----------------------------------------
@@ -1005,36 +1005,36 @@ Table 9.44: json and jsonb operators
10051005-- | Get JSON value (object field or array element) at a key.
10061006(.->)
10071007 :: (json `In` PGJsonType, key `In` PGJsonKey)
1008− => Expression commons schemas params grp from (nullity json)
1009− -> Expression commons schemas params grp from (nullity key)
1010− -> Expression commons schemas params grp from ('Null json)
1008+ => Expression grp commons schemas params from (nullity json)
1009+ -> Expression grp commons schemas params from (nullity key)
1010+ -> Expression grp commons schemas params from ('Null json)
10111011infixl 8 .->
10121012(.->) = unsafeBinaryOp "->"
10131013
10141014-- | Get JSON value (object field or array element) at a key, as text.
10151015(.->>)
10161016 :: (json `In` PGJsonType, key `In` PGJsonKey)
1017− => Expression commons schemas params grp from (nullity json)
1018− -> Expression commons schemas params grp from (nullity key)
1019− -> Expression commons schemas params grp from ('Null 'PGtext)
1017+ => Expression grp commons schemas params from (nullity json)
1018+ -> Expression grp commons schemas params from (nullity key)
1019+ -> Expression grp commons schemas params from ('Null 'PGtext)
10201020infixl 8 .->>
10211021(.->>) = unsafeBinaryOp "->>"
10221022
10231023-- | Get JSON value at a specified path.
10241024(.#>)
10251025 :: (json `In` PGJsonType, PGTextArray "(.#>)" path)
1026− => Expression commons schemas params grp from (nullity json)
1027− -> Expression commons schemas params grp from (nullity path)
1028− -> Expression commons schemas params grp from ('Null json)
1026+ => Expression grp commons schemas params from (nullity json)
1027+ -> Expression grp commons schemas params from (nullity path)
1028+ -> Expression grp commons schemas params from ('Null json)
10291029infixl 8 .#>
10301030(.#>) = unsafeBinaryOp "#>"
10311031
10321032-- | Get JSON value at a specified path as text.
10331033(.#>>)
10341034 :: (json `In` PGJsonType, PGTextArray "(.#>>)" path)
1035− => Expression commons schemas params grp from (nullity json)
1036− -> Expression commons schemas params grp from (nullity path)
1037− -> Expression commons schemas params grp from ('Null 'PGtext)
1035+ => Expression grp commons schemas params from (nullity json)
1036+ -> Expression grp commons schemas params from (nullity path)
1037+ -> Expression grp commons schemas params from ('Null 'PGtext)
10381038infixl 8 .#>>
10391039(.#>>) = unsafeBinaryOp "#>>"
10401040
@@ -1043,42 +1043,42 @@ infixl 8 .#>>
10431043-- | Does the left JSON value contain the right JSON path/value entries at the
10441044-- top level?
10451045(.@>)
1046− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1047− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1048− -> Condition commons schemas params grp from
1046+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1047+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
1048+ -> Condition grp commons schemas params from
10491049infixl 9 .@>
10501050(.@>) = unsafeBinaryOp "@>"
10511051
10521052-- | Are the left JSON path/value entries contained at the top level within the
10531053-- right JSON value?
10541054(.<@)
1055− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1056− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1057− -> Condition commons schemas params grp from
1055+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1056+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
1057+ -> Condition grp commons schemas params from
10581058infixl 9 .<@
10591059(.<@) = unsafeBinaryOp "<@"
10601060
10611061-- | Does the string exist as a top-level key within the JSON value?
10621062(.?)
1063− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1064− -> Expression commons schemas params grp from (nullity 'PGtext)
1065− -> Condition commons schemas params grp from
1063+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1064+ -> Expression grp commons schemas params from (nullity 'PGtext)
1065+ -> Condition grp commons schemas params from
10661066infixl 9 .?
10671067(.?) = unsafeBinaryOp "?"
10681068
10691069-- | Do any of these array strings exist as top-level keys?
10701070(.?|)
1071− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1072− -> Expression commons schemas params grp from (nullity ('PGvararray ('NotNull 'PGtext)))
1073− -> Condition commons schemas params grp from
1071+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1072+ -> Expression grp commons schemas params from (nullity ('PGvararray ('NotNull 'PGtext)))
1073+ -> Condition grp commons schemas params from
10741074infixl 9 .?|
10751075(.?|) = unsafeBinaryOp "?|"
10761076
10771077-- | Do all of these array strings exist as top-level keys?
10781078(.?&)
1079− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1080− -> Expression commons schemas params grp from (nullity ('PGvararray ('NotNull 'PGtext)))
1081− -> Condition commons schemas params grp from
1079+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1080+ -> Expression grp commons schemas params from (nullity ('PGvararray ('NotNull 'PGtext)))
1081+ -> Condition grp commons schemas params from
10821082infixl 9 .?&
10831083(.?&) = unsafeBinaryOp "?&"
10841084
@@ -1101,9 +1101,9 @@ instance
11011101-- count from the end). Throws an error if top level container is not an array.
11021102(.-.)
11031103 :: (key `In` '[ 'PGtext, 'PGvararray ('NotNull 'PGtext), 'PGint4, 'PGint2 ]) -- hlint error without parens here
1104− => Expression commons schemas params grp from (nullity 'PGjsonb)
1105− -> Expression commons schemas params grp from (nullity key)
1106− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1104+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1105+ -> Expression grp commons schemas params from (nullity key)
1106+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
11071107infixl 6 .-.
11081108(.-.) = unsafeBinaryOp "-"
11091109
@@ -1111,9 +1111,9 @@ infixl 6 .-.
11111111-- integers count from the end)
11121112(#-.)
11131113 :: PGTextArray "(#-.)" arrayty
1114− => Expression commons schemas params grp from (nullity 'PGjsonb)
1115− -> Expression commons schemas params grp from (nullity arrayty)
1116− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1114+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1115+ -> Expression grp commons schemas params from (nullity arrayty)
1116+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
11171117infixl 6 #-.
11181118(#-.) = unsafeBinaryOp "#-"
11191119
@@ -1124,14 +1124,14 @@ Table 9.45: JSON creation functions
11241124-- | Literal binary JSON
11251125jsonbLit
11261126 :: JSON.ToJSON x
1127− => x -> Expression commons schemas params grp from (nullity 'PGjsonb)
1127+ => x -> Expression grp commons schemas params from (nullity 'PGjsonb)
11281128jsonbLit = cast jsonb . UnsafeExpression
11291129 . singleQuotedUtf8 . toStrict . JSON.encode
11301130
11311131-- | Literal JSON
11321132jsonLit
11331133 :: JSON.ToJSON x
1134− => x -> Expression commons schemas params grp from (nullity 'PGjson)
1134+ => x -> Expression grp commons schemas params from (nullity 'PGjson)
11351135jsonLit = cast json . UnsafeExpression
11361136 . singleQuotedUtf8 . toStrict . JSON.encode
11371137
@@ -1142,8 +1142,8 @@ jsonLit = cast json . UnsafeExpression
11421142-- number, a Boolean, or a null value, the text representation will be used, in
11431143-- such a fashion that it is a valid json value.
11441144toJson
1145− :: Expression commons schemas params grp from (nullity ty)
1146− -> Expression commons schemas params grp from (nullity 'PGjson)
1145+ :: Expression grp commons schemas params from (nullity ty)
1146+ -> Expression grp commons schemas params from (nullity 'PGjson)
11471147toJson = unsafeFunction "to_json"
11481148
11491149-- | Returns the value as jsonb. Arrays and composites are converted
@@ -1153,43 +1153,43 @@ toJson = unsafeFunction "to_json"
11531153-- number, a Boolean, or a null value, the text representation will be used, in
11541154-- such a fashion that it is a valid jsonb value.
11551155toJsonb
1156− :: Expression commons schemas params grp from (nullity ty)
1157− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1156+ :: Expression grp commons schemas params from (nullity ty)
1157+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
11581158toJsonb = unsafeFunction "to_jsonb"
11591159
11601160-- | Returns the array as a JSON array. A PostgreSQL multidimensional array
11611161-- becomes a JSON array of arrays.
11621162arrayToJson
11631163 :: PGArray "arrayToJson" arr
1164− => Expression commons schemas params grp from (nullity arr)
1165− -> Expression commons schemas params grp from (nullity 'PGjson)
1164+ => Expression grp commons schemas params from (nullity arr)
1165+ -> Expression grp commons schemas params from (nullity 'PGjson)
11661166arrayToJson = unsafeFunction "array_to_json"
11671167
11681168-- | Returns the row as a JSON object.
11691169rowToJson
1170− :: Expression commons schemas params grp from (nullity ('PGcomposite ty))
1171− -> Expression commons schemas params grp from (nullity 'PGjson)
1170+ :: Expression grp commons schemas params from (nullity ('PGcomposite ty))
1171+ -> Expression grp commons schemas params from (nullity 'PGjson)
11721172rowToJson = unsafeFunction "row_to_json"
11731173
11741174-- | Builds a possibly-heterogeneously-typed JSON array out of a variadic
11751175-- argument list.
11761176jsonBuildArray
11771177 :: SListI elems
1178− => NP (Expression commons schemas params grp from) elems
1179− -> Expression commons schemas params grp from (nullity 'PGjson)
1178+ => NP (Expression grp commons schemas params from) elems
1179+ -> Expression grp commons schemas params from (nullity 'PGjson)
11801180jsonBuildArray = unsafeVariadicFunction "json_build_array"
11811181
11821182-- | Builds a possibly-heterogeneously-typed (binary) JSON array out of a
11831183-- variadic argument list.
11841184jsonbBuildArray
11851185 :: SListI elems
1186− => NP (Expression commons schemas params grp from) elems
1187− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1186+ => NP (Expression grp commons schemas params from) elems
1187+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
11881188jsonbBuildArray = unsafeVariadicFunction "jsonb_build_array"
11891189
11901190unsafeRowFunction
11911191 :: All Top elems
1192− => NP (Aliased (Expression commons schemas params grp from)) elems
1192+ => NP (Aliased (Expression grp commons schemas params from)) elems
11931193 -> [ByteString]
11941194unsafeRowFunction =
11951195 (`appEndo` []) . hcfoldMap (Proxy :: Proxy Top)
@@ -1204,8 +1204,8 @@ unsafeRowFunction =
12041204-- and values.
12051205jsonBuildObject
12061206 :: All Top elems
1207− => NP (Aliased (Expression commons schemas params grp from)) elems
1208− -> Expression commons schemas params grp from (nullity 'PGjson)
1207+ => NP (Aliased (Expression grp commons schemas params from)) elems
1208+ -> Expression grp commons schemas params from (nullity 'PGjson)
12091209jsonBuildObject
12101210 = unsafeFunction "json_build_object"
12111211 . UnsafeExpression
@@ -1217,8 +1217,8 @@ jsonBuildObject
12171217-- between text and values.
12181218jsonbBuildObject
12191219 :: All Top elems
1220− => NP (Aliased (Expression commons schemas params grp from)) elems
1221− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1220+ => NP (Aliased (Expression grp commons schemas params from)) elems
1221+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
12221222jsonbBuildObject
12231223 = unsafeFunction "jsonb_build_object"
12241224 . UnsafeExpression
@@ -1231,8 +1231,8 @@ jsonbBuildObject
12311231-- array has exactly two elements, which are taken as a key/value pair.
12321232jsonObject
12331233 :: PGArrayOf "jsonObject" arr ('NotNull 'PGtext)
1234− => Expression commons schemas params grp from (nullity arr)
1235− -> Expression commons schemas params grp from (nullity 'PGjson)
1234+ => Expression grp commons schemas params from (nullity arr)
1235+ -> Expression grp commons schemas params from (nullity 'PGjson)
12361236jsonObject = unsafeFunction "json_object"
12371237
12381238-- | Builds a binary JSON object out of a text array. The array must have either
@@ -1241,8 +1241,8 @@ jsonObject = unsafeFunction "json_object"
12411241-- array has exactly two elements, which are taken as a key/value pair.
12421242jsonbObject
12431243 :: PGArrayOf "jsonbObject" arr ('NotNull 'PGtext)
1244− => Expression commons schemas params grp from (nullity arr)
1245− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1244+ => Expression grp commons schemas params from (nullity arr)
1245+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
12461246jsonbObject = unsafeFunction "jsonb_object"
12471247
12481248-- | This is an alternate form of 'jsonObject' that takes two arrays; one for
@@ -1250,9 +1250,9 @@ jsonbObject = unsafeFunction "jsonb_object"
12501250jsonZipObject
12511251 :: ( PGArrayOf "jsonZipObject" keysArray ('NotNull 'PGtext)
12521252 , PGArrayOf "jsonZipObject" valuesArray ('NotNull 'PGtext))
1253− => Expression commons schemas params grp from (nullity keysArray)
1254− -> Expression commons schemas params grp from (nullity valuesArray)
1255− -> Expression commons schemas params grp from (nullity 'PGjson)
1253+ => Expression grp commons schemas params from (nullity keysArray)
1254+ -> Expression grp commons schemas params from (nullity valuesArray)
1255+ -> Expression grp commons schemas params from (nullity 'PGjson)
12561256jsonZipObject ks vs =
12571257 unsafeVariadicFunction "json_object" (ks :* vs :* Nil)
12581258
@@ -1262,9 +1262,9 @@ jsonZipObject ks vs =
12621262jsonbZipObject
12631263 :: ( PGArrayOf "jsonbZipObject" keysArray ('NotNull 'PGtext)
12641264 , PGArrayOf "jsonbZipObject" valuesArray ('NotNull 'PGtext))
1265− => Expression commons schemas params grp from (nullity keysArray)
1266− -> Expression commons schemas params grp from (nullity valuesArray)
1267− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1265+ => Expression grp commons schemas params from (nullity keysArray)
1266+ -> Expression grp commons schemas params from (nullity valuesArray)
1267+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
12681268jsonbZipObject ks vs =
12691269 unsafeVariadicFunction "jsonb_object" (ks :* vs :* Nil)
12701270
@@ -1274,23 +1274,23 @@ Table 9.46: JSON processing functions
12741274
12751275-- | Returns the number of elements in the outermost JSON array.
12761276jsonArrayLength
1277− :: Expression commons schemas params grp from (nullity 'PGjson)
1278− -> Expression commons schemas params grp from (nullity 'PGint4)
1277+ :: Expression grp commons schemas params from (nullity 'PGjson)
1278+ -> Expression grp commons schemas params from (nullity 'PGint4)
12791279jsonArrayLength = unsafeFunction "json_array_length"
12801280
12811281-- | Returns the number of elements in the outermost binary JSON array.
12821282jsonbArrayLength
1283− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1284− -> Expression commons schemas params grp from (nullity 'PGint4)
1283+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1284+ -> Expression grp commons schemas params from (nullity 'PGint4)
12851285jsonbArrayLength = unsafeFunction "jsonb_array_length"
12861286
12871287-- | Returns JSON value pointed to by the given path (equivalent to #>
12881288-- operator).
12891289jsonExtractPath
12901290 :: SListI elems
1291− => Expression commons schemas params grp from (nullity 'PGjson)
1292− -> NP (Expression commons schemas params grp from) elems
1293− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1291+ => Expression grp commons schemas params from (nullity 'PGjson)
1292+ -> NP (Expression grp commons schemas params from) elems
1293+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
12941294jsonExtractPath x xs =
12951295 unsafeVariadicFunction "json_extract_path" (x :* xs)
12961296
@@ -1298,9 +1298,9 @@ jsonExtractPath x xs =
12981298-- operator).
12991299jsonbExtractPath
13001300 :: SListI elems
1301− => Expression commons schemas params grp from (nullity 'PGjsonb)
1302− -> NP (Expression commons schemas params grp from) elems
1303− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1301+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1302+ -> NP (Expression grp commons schemas params from) elems
1303+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
13041304jsonbExtractPath x xs =
13051305 unsafeVariadicFunction "jsonb_extract_path" (x :* xs)
13061306
@@ -1308,9 +1308,9 @@ jsonbExtractPath x xs =
13081308-- operator), as text.
13091309jsonExtractPathAsText
13101310 :: SListI elems
1311− => Expression commons schemas params grp from (nullity 'PGjson)
1312− -> NP (Expression commons schemas params grp from) elems
1313− -> Expression commons schemas params grp from (nullity 'PGjson)
1311+ => Expression grp commons schemas params from (nullity 'PGjson)
1312+ -> NP (Expression grp commons schemas params from) elems
1313+ -> Expression grp commons schemas params from (nullity 'PGjson)
13141314jsonExtractPathAsText x xs =
13151315 unsafeVariadicFunction "json_extract_path_text" (x :* xs)
13161316
@@ -1318,38 +1318,38 @@ jsonExtractPathAsText x xs =
13181318-- operator), as text.
13191319jsonbExtractPathAsText
13201320 :: SListI elems
1321− => Expression commons schemas params grp from (nullity 'PGjsonb)
1322− -> NP (Expression commons schemas params grp from) elems
1323− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1321+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1322+ -> NP (Expression grp commons schemas params from) elems
1323+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
13241324jsonbExtractPathAsText x xs =
13251325 unsafeVariadicFunction "jsonb_extract_path_text" (x :* xs)
13261326
13271327-- | Returns the type of the outermost JSON value as a text string. Possible
13281328-- types are object, array, string, number, boolean, and null.
13291329jsonTypeof
1330− :: Expression commons schemas params grp from (nullity 'PGjson)
1331− -> Expression commons schemas params grp from (nullity 'PGtext)
1330+ :: Expression grp commons schemas params from (nullity 'PGjson)
1331+ -> Expression grp commons schemas params from (nullity 'PGtext)
13321332jsonTypeof = unsafeFunction "json_typeof"
13331333
13341334-- | Returns the type of the outermost binary JSON value as a text string.
13351335-- Possible types are object, array, string, number, boolean, and null.
13361336jsonbTypeof
1337− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1338− -> Expression commons schemas params grp from (nullity 'PGtext)
1337+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1338+ -> Expression grp commons schemas params from (nullity 'PGtext)
13391339jsonbTypeof = unsafeFunction "jsonb_typeof"
13401340
13411341-- | Returns its argument with all object fields that have null values omitted.
13421342-- Other null values are untouched.
13431343jsonStripNulls
1344− :: Expression commons schemas params grp from (nullity 'PGjson)
1345− -> Expression commons schemas params grp from (nullity 'PGjson)
1344+ :: Expression grp commons schemas params from (nullity 'PGjson)
1345+ -> Expression grp commons schemas params from (nullity 'PGjson)
13461346jsonStripNulls = unsafeFunction "json_strip_nulls"
13471347
13481348-- | Returns its argument with all object fields that have null values omitted.
13491349-- Other null values are untouched.
13501350jsonbStripNulls
1351− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1352− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1351+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1352+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
13531353jsonbStripNulls = unsafeFunction "jsonb_strip_nulls"
13541354
13551355-- | @ jsonbSet target path new_value create_missing @
@@ -1361,11 +1361,11 @@ jsonbStripNulls = unsafeFunction "jsonb_strip_nulls"
13611361-- arrays.
13621362jsonbSet
13631363 :: PGTextArray "jsonbSet" arr
1364− => Expression commons schemas params grp from (nullity 'PGjsonb)
1365− -> Expression commons schemas params grp from (nullity arr)
1366− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1367− -> Maybe (Expression commons schemas params grp from (nullity 'PGbool))
1368− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1364+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1365+ -> Expression grp commons schemas params from (nullity arr)
1366+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
1367+ -> Maybe (Expression grp commons schemas params from (nullity 'PGbool))
1368+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
13691369jsonbSet tgt path val createMissing = case createMissing of
13701370 Just m -> unsafeVariadicFunction "jsonb_set" (tgt :* path :* val :* m :* Nil)
13711371 Nothing -> unsafeVariadicFunction "jsonb_set" (tgt :* path :* val :* Nil)
@@ -1380,19 +1380,19 @@ jsonbSet tgt path val createMissing = case createMissing of
13801380-- in path count from the end of JSON arrays.
13811381jsonbInsert
13821382 :: PGTextArray "jsonbInsert" arr
1383− => Expression commons schemas params grp from (nullity 'PGjsonb)
1384− -> Expression commons schemas params grp from (nullity arr)
1385− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1386− -> Maybe (Expression commons schemas params grp from (nullity 'PGbool))
1387− -> Expression commons schemas params grp from (nullity 'PGjsonb)
1383+ => Expression grp commons schemas params from (nullity 'PGjsonb)
1384+ -> Expression grp commons schemas params from (nullity arr)
1385+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
1386+ -> Maybe (Expression grp commons schemas params from (nullity 'PGbool))
1387+ -> Expression grp commons schemas params from (nullity 'PGjsonb)
13881388jsonbInsert tgt path val insertAfter = case insertAfter of
13891389 Just i -> unsafeVariadicFunction "jsonb_insert" (tgt :* path :* val :* i :* Nil)
13901390 Nothing -> unsafeVariadicFunction "jsonb_insert" (tgt :* path :* val :* Nil)
13911391
13921392-- | Returns its argument as indented JSON text.
13931393jsonbPretty
1394− :: Expression commons schemas params grp from (nullity 'PGjsonb)
1395− -> Expression commons schemas params grp from (nullity 'PGtext)
1394+ :: Expression grp commons schemas params from (nullity 'PGjsonb)
1395+ -> Expression grp commons schemas params from (nullity 'PGtext)
13961396jsonbPretty = unsafeFunction "jsonb_pretty"
13971397
13981398{-----------------------------------------
@@ -1402,54 +1402,54 @@ aggregation
14021402-- | escape hatch to define aggregate functions
14031403unsafeAggregate
14041404 :: ByteString -- ^ aggregate function
1405− -> Expression commons schemas from 'Ungrouped params (xty)
1406− -> Expression commons schemas from ('Grouped bys) params (yty)
1405+ -> Expression 'Ungrouped commons schemas params from xty
1406+ -> Expression ('Grouped bys) commons schemas params from yty
14071407unsafeAggregate fun x = UnsafeExpression $ mconcat
14081408 [fun, "(", renderSQL x, ")"]
14091409
14101410-- | escape hatch to define aggregate functions over distinct values
14111411unsafeAggregateDistinct
14121412 :: ByteString -- ^ aggregate function
1413− -> Expression commons schemas from 'Ungrouped params (xty)
1414− -> Expression commons schemas from ('Grouped bys) params (yty)
1413+ -> Expression 'Ungrouped commons schemas params from xty
1414+ -> Expression ('Grouped bys) commons schemas params from yty
14151415unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
14161416 [fun, "(DISTINCT ", renderSQL x, ")"]
14171417
14181418-- | >>> :{
14191419-- let
1420−-- expression :: Expression commons schemas params ('Grouped bys) '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('Null 'PGnumeric)
1420+-- expression :: Expression ('Grouped bys) commons schemas params '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('Null 'PGnumeric)
14211421-- expression = sum_ #col
14221422-- in printSQL expression
14231423-- :}
14241424-- sum("col")
14251425sum_
14261426 :: ty `In` PGNum
1427− => Expression commons schemas from 'Ungrouped params (nullity ty)
1427+ => Expression 'Ungrouped commons schemas params from (nullity ty)
14281428 -- ^ what to sum
1429− -> Expression commons schemas from ('Grouped bys) params (nullity ty)
1429+ -> Expression ('Grouped bys) commons schemas params from (nullity ty)
14301430sum_ = unsafeAggregate "sum"
14311431
14321432-- | >>> :{
14331433-- let
1434−-- expression :: Expression commons schemas params ('Grouped bys) '[tab ::: '["col" ::: nullity 'PGnumeric]] (nullity 'PGnumeric)
1434+-- expression :: Expression ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGnumeric]] (nullity 'PGnumeric)
14351435-- expression = sumDistinct #col
14361436-- in printSQL expression
14371437-- :}
14381438-- sum(DISTINCT "col")
14391439sumDistinct
14401440 :: ty `In` PGNum
1441− => Expression commons schemas from 'Ungrouped params (nullity ty)
1441+ => Expression 'Ungrouped commons schemas params from (nullity ty)
14421442 -- ^ what to sum
1443− -> Expression commons schemas from ('Grouped bys) params (nullity ty)
1443+ -> Expression ('Grouped bys) commons schemas params from (nullity ty)
14441444sumDistinct = unsafeAggregateDistinct "sum"
14451445
14461446-- | A constraint for `PGType`s that you can take averages of and the resulting
14471447-- `PGType`.
14481448class PGAvg ty avg | ty -> avg where
14491449 avg, avgDistinct
1450− :: Expression commons schemas from 'Ungrouped params (nullity ty)
1450+ :: Expression 'Ungrouped commons schemas params from (nullity ty)
14511451 -- ^ what to average
1452− -> Expression commons schemas from ('Grouped bys) params (nullity avg)
1452+ -> Expression ('Grouped bys) commons schemas params from (nullity avg)
14531453 avg = unsafeAggregate "avg"
14541454 avgDistinct = unsafeAggregateDistinct "avg"
14551455instance PGAvg 'PGint2 'PGnumeric
@@ -1469,37 +1469,37 @@ instance PGAvg 'PGinterval 'PGinterval
14691469-- bit_and("col")
14701470bitAnd
14711471 :: int `In` PGIntegral
1472− => Expression commons schemas from 'Ungrouped params (nullity int)
1472+ => Expression 'Ungrouped commons schemas params from (nullity int)
14731473 -- ^ what to aggregate
1474− -> Expression commons schemas from ('Grouped bys) params (nullity int)
1474+ -> Expression ('Grouped bys) commons schemas params from (nullity int)
14751475bitAnd = unsafeAggregate "bit_and"
14761476
14771477-- | >>> :{
14781478-- let
1479−-- expression :: Expression commons schemas params ('Grouped bys) '[tab ::: '["col" ::: nullity 'PGint4]] (nullity 'PGint4)
1479+-- expression :: Expression ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGint4]] (nullity 'PGint4)
14801480-- expression = bitOr #col
14811481-- in printSQL expression
14821482-- :}
14831483-- bit_or("col")
14841484bitOr
14851485 :: int `In` PGIntegral
1486− => Expression commons schemas from 'Ungrouped params (nullity int)
1486+ => Expression 'Ungrouped commons schemas params from (nullity int)
14871487 -- ^ what to aggregate
1488− -> Expression commons schemas from ('Grouped bys) params (nullity int)
1488+ -> Expression ('Grouped bys) commons schemas params from (nullity int)
14891489bitOr = unsafeAggregate "bit_or"
14901490
14911491-- | >>> :{
14921492-- let
1493−-- expression :: Expression commons schemas params ('Grouped bys) '[tab ::: '["col" ::: nullity 'PGint4]] (nullity 'PGint4)
1493+-- expression :: Expression ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGint4]] (nullity 'PGint4)
14941494-- expression = bitAndDistinct #col
14951495-- in printSQL expression
14961496-- :}
14971497-- bit_and(DISTINCT "col")
14981498bitAndDistinct
14991499 :: int `In` PGIntegral
1500− => Expression commons schemas from 'Ungrouped params (nullity int)
1500+ => Expression 'Ungrouped commons schemas params from (nullity int)
15011501 -- ^ what to aggregate
1502− -> Expression commons schemas from ('Grouped bys) params (nullity int)
1502+ -> Expression ('Grouped bys) commons schemas params from (nullity int)
15031503bitAndDistinct = unsafeAggregateDistinct "bit_and"
15041504
15051505-- | >>> :{
@@ -1511,9 +1511,9 @@ bitAndDistinct = unsafeAggregateDistinct "bit_and"
15111511-- bit_or(DISTINCT "col")
15121512bitOrDistinct
15131513 :: int `In` PGIntegral
1514− => Expression commons schemas from 'Ungrouped params (nullity int)
1514+ => Expression 'Ungrouped commons schemas params from (nullity int)
15151515 -- ^ what to aggregate
1516− -> Expression commons schemas from ('Grouped bys) params (nullity int)
1516+ -> Expression ('Grouped bys) commons schemas params from (nullity int)
15171517bitOrDistinct = unsafeAggregateDistinct "bit_or"
15181518
15191519-- | >>> :{
@@ -1524,9 +1524,9 @@ bitOrDistinct = unsafeAggregateDistinct "bit_or"
15241524-- :}
15251525-- bool_and("col")
15261526boolAnd
1527− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1527+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
15281528 -- ^ what to aggregate
1529− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1529+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
15301530boolAnd = unsafeAggregate "bool_and"
15311531
15321532-- | >>> :{
@@ -1537,9 +1537,9 @@ boolAnd = unsafeAggregate "bool_and"
15371537-- :}
15381538-- bool_or("col")
15391539boolOr
1540− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1540+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
15411541 -- ^ what to aggregate
1542− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1542+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
15431543boolOr = unsafeAggregate "bool_or"
15441544
15451545-- | >>> :{
@@ -1550,9 +1550,9 @@ boolOr = unsafeAggregate "bool_or"
15501550-- :}
15511551-- bool_and(DISTINCT "col")
15521552boolAndDistinct
1553− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1553+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
15541554 -- ^ what to aggregate
1555− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1555+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
15561556boolAndDistinct = unsafeAggregateDistinct "bool_and"
15571557
15581558-- | >>> :{
@@ -1563,9 +1563,9 @@ boolAndDistinct = unsafeAggregateDistinct "bool_and"
15631563-- :}
15641564-- bool_or(DISTINCT "col")
15651565boolOrDistinct
1566− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1566+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
15671567 -- ^ what to aggregate
1568− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1568+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
15691569boolOrDistinct = unsafeAggregateDistinct "bool_or"
15701570
15711571-- | A special aggregation that does not require an input
@@ -1573,7 +1573,7 @@ boolOrDistinct = unsafeAggregateDistinct "bool_or"
15731573-- >>> printSQL countStar
15741574-- count(*)
15751575countStar
1576− :: Expression commons schemas from ('Grouped bys) params ('NotNull 'PGint8)
1576+ :: Expression ('Grouped bys) commons schemas params from ('NotNull 'PGint8)
15771577countStar = UnsafeExpression $ "count(*)"
15781578
15791579-- | >>> :{
@@ -1584,9 +1584,9 @@ countStar = UnsafeExpression $ "count(*)"
15841584-- :}
15851585-- count("col")
15861586count
1587− :: Expression commons schemas from 'Ungrouped params ty
1587+ :: Expression 'Ungrouped commons schemas params from ty
15881588 -- ^ what to count
1589− -> Expression commons schemas from ('Grouped bys) params ('NotNull 'PGint8)
1589+ -> Expression ('Grouped bys) commons schemas params from ('NotNull 'PGint8)
15901590count = unsafeAggregate "count"
15911591
15921592-- | >>> :{
@@ -1597,9 +1597,9 @@ count = unsafeAggregate "count"
15971597-- :}
15981598-- count(DISTINCT "col")
15991599countDistinct
1600− :: Expression commons schemas from 'Ungrouped params ty
1600+ :: Expression 'Ungrouped commons schemas params from ty
16011601 -- ^ what to count
1602− -> Expression commons schemas from ('Grouped bys) params ('NotNull 'PGint8)
1602+ -> Expression ('Grouped bys) commons schemas params from ('NotNull 'PGint8)
16031603countDistinct = unsafeAggregateDistinct "count"
16041604
16051605-- | synonym for `boolAnd`
@@ -1612,9 +1612,9 @@ countDistinct = unsafeAggregateDistinct "count"
16121612-- :}
16131613-- every("col")
16141614every
1615− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1615+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
16161616 -- ^ what to aggregate
1617− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1617+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
16181618every = unsafeAggregate "every"
16191619
16201620-- | synonym for `boolAndDistinct`
@@ -1627,16 +1627,16 @@ every = unsafeAggregate "every"
16271627-- :}
16281628-- every(DISTINCT "col")
16291629everyDistinct
1630− :: Expression commons schemas from 'Ungrouped params (nullity 'PGbool)
1630+ :: Expression 'Ungrouped commons schemas params from (nullity 'PGbool)
16311631 -- ^ what to aggregate
1632− -> Expression commons schemas from ('Grouped bys) params (nullity 'PGbool)
1632+ -> Expression ('Grouped bys) commons schemas params from (nullity 'PGbool)
16331633everyDistinct = unsafeAggregateDistinct "every"
16341634
16351635-- | minimum and maximum aggregation
16361636max_, min_, maxDistinct, minDistinct
1637− :: Expression commons schemas from 'Ungrouped params (nullity ty)
1637+ :: Expression 'Ungrouped commons schemas params from (nullity ty)
16381638 -- ^ what to aggregate
1639− -> Expression commons schemas from ('Grouped bys) params (nullity ty)
1639+ -> Expression ('Grouped bys) commons schemas params from (nullity ty)
16401640max_ = unsafeAggregate "max"
16411641min_ = unsafeAggregate "min"
16421642maxDistinct = unsafeAggregateDistinct "max"
@@ -1822,35 +1822,35 @@ Sorting
18221822-- `AscNullsLast`, `DescNullsFirst` and `DescNullsLast` options are used to
18231823-- determine whether nulls appear before or after non-null values in the sort
18241824-- ordering of a `Null` result column.
1825−data SortExpression commons schemas params grp from where
1825+data SortExpression grp commons schemas params from where
18261826 Asc
1827− :: Expression commons schemas params grp from ('NotNull ty)
1828− -> SortExpression commons schemas params grp from
1827+ :: Expression grp commons schemas params from ('NotNull ty)
1828+ -> SortExpression grp commons schemas params from
18291829 Desc
1830− :: Expression commons schemas params grp from ('NotNull ty)
1831− -> SortExpression commons schemas params grp from
1830+ :: Expression grp commons schemas params from ('NotNull ty)
1831+ -> SortExpression grp commons schemas params from
18321832 AscNullsFirst
1833− :: Expression commons schemas params grp from ('Null ty)
1834− -> SortExpression commons schemas params grp from
1833+ :: Expression grp commons schemas params from ('Null ty)
1834+ -> SortExpression grp commons schemas params from
18351835 AscNullsLast
1836− :: Expression commons schemas params grp from ('Null ty)
1837− -> SortExpression commons schemas params grp from
1836+ :: Expression grp commons schemas params from ('Null ty)
1837+ -> SortExpression grp commons schemas params from
18381838 DescNullsFirst
1839− :: Expression commons schemas params grp from ('Null ty)
1840− -> SortExpression commons schemas params grp from
1839+ :: Expression grp commons schemas params from ('Null ty)
1840+ -> SortExpression grp commons schemas params from
18411841 DescNullsLast
1842− :: Expression commons schemas params grp from ('Null ty)
1843− -> SortExpression commons schemas params grp from
1844−deriving instance Show (SortExpression commons schemas params grp from)
1842+ :: Expression grp commons schemas params from ('Null ty)
1843+ -> SortExpression grp commons schemas params from
1844+deriving instance Show (SortExpression grp commons schemas params from)
18451845
18461846class OrderBy expr where
18471847 orderBy
1848− :: [SortExpression commons schemas params grp from]
1849− -> expr commons schemas params grp from
1850− -> expr commons schemas params grp from
1848+ :: [SortExpression grp commons schemas params from]
1849+ -> expr grp commons schemas params from
1850+ -> expr grp commons schemas params from
18511851
18521852-- | Render a `SortExpression`.
1853−instance RenderSQL (SortExpression commons schemas params grp from) where
1853+instance RenderSQL (SortExpression grp commons schemas params from) where
18541854 renderSQL = \case
18551855 Asc expression -> renderSQL expression <+> "ASC"
18561856 Desc expression -> renderSQL expression <+> "DESC"
@@ -1861,12 +1861,12 @@ instance RenderSQL (SortExpression commons schemas params grp from) where
18611861 AscNullsLast expression -> renderSQL expression <+> "ASC NULLS LAST"
18621862 DescNullsLast expression -> renderSQL expression <+> "DESC NULLS LAST"
18631863
1864−data WindowDefinition commons schemas params grp from where
1864+data WindowDefinition grp commons schemas params from where
18651865 WindowDefinition
18661866 :: SListI bys
1867− => NP (Expression commons schemas params grp from) bys
1868− -> [SortExpression commons schemas params grp from]
1869− -> WindowDefinition commons schemas params grp from
1867+ => NP (Expression grp commons schemas params from) bys
1868+ -> [SortExpression grp commons schemas params from]
1869+ -> WindowDefinition grp commons schemas params from
18701870
18711871instance OrderBy WindowDefinition where
18721872 orderBy sortsR (WindowDefinition parts sortsL)
@@ -1886,49 +1886,49 @@ instance RenderSQL (WindowDefinition commons schemas from grp params) where
18861886
18871887partitionBy
18881888 :: SListI bys
1889− => NP (Expression commons schemas params grp from) bys
1890− -> WindowDefinition commons schemas params grp from
1889+ => NP (Expression grp commons schemas params from) bys
1890+ -> WindowDefinition grp commons schemas params from
18911891partitionBy bys = WindowDefinition bys []
18921892
18931893newtype WindowFunction
1894+ (grp :: Grouping)
18941895 (commons :: FromType)
18951896 (schemas :: SchemasType)
18961897 (params :: [NullityType])
1897− (grp :: Grouping)
18981898 (from :: FromType)
18991899 (ty :: NullityType)
19001900 = UnsafeWindowFunction { renderWindowFunction :: ByteString }
19011901 deriving (GHC.Generic,Show,Eq,Ord,NFData)
19021902
1903−instance RenderSQL (WindowFunction commons schemas params grp from ty) where
1903+instance RenderSQL (WindowFunction grp commons schemas params from ty) where
19041904 renderSQL = renderWindowFunction
19051905
19061906{- | rank of the current row with gaps; same as `rowNumber` of its first peer
19071907>>> printSQL rank
19081908rank()
19091909-}
1910−rank :: WindowFunction commons schemas from grp params ('NotNull 'PGint8)
1910+rank :: WindowFunction grp commons schemas params from ('NotNull 'PGint8)
19111911rank = UnsafeWindowFunction "rank()"
19121912
19131913{- | number of the current row within its partition, counting from 1
19141914>>> printSQL rowNumber
19151915row_number()
19161916-}
1917−rowNumber :: WindowFunction commons schemas from grp params ('NotNull 'PGint8)
1917+rowNumber :: WindowFunction grp commons schemas params from ('NotNull 'PGint8)
19181918rowNumber = UnsafeWindowFunction "row_number()"
19191919
19201920{- | rank of the current row without gaps; this function counts peer groups
19211921>>> printSQL denseRank
19221922dense_rank()
19231923-}
1924−denseRank :: WindowFunction commons schemas from grp params ('NotNull 'PGint8)
1924+denseRank :: WindowFunction grp commons schemas params from ('NotNull 'PGint8)
19251925denseRank = UnsafeWindowFunction "dense_rank()"
19261926
19271927{- | relative rank of the current row: (rank - 1) / (total partition rows - 1)
19281928>>> printSQL percentRank
19291929percent_rank()
19301930-}
1931−percentRank :: WindowFunction commons schemas from grp params ('NotNull 'PGfloat8)
1931+percentRank :: WindowFunction grp commons schemas params from ('NotNull 'PGfloat8)
19321932percentRank = UnsafeWindowFunction "percent_rank()"
19331933
19341934{- | cumulative distribution: (number of partition rows
@@ -1936,16 +1936,16 @@ preceding or peer with current row) / total partition rows
19361936>>> printSQL cumeDist
19371937cume_dist()
19381938-}
1939−cumeDist :: WindowFunction commons schemas from grp params ('NotNull 'PGfloat8)
1939+cumeDist :: WindowFunction grp commons schemas params from ('NotNull 'PGfloat8)
19401940cumeDist = UnsafeWindowFunction "cume_dist()"
19411941
19421942{- | integer ranging from 1 to the argument value,
19431943dividing the partition as equally as possible
19441944-}
19451945ntile
1946− :: Expression commons schemas from grp params ('NotNull 'PGint4)
1946+ :: Expression grp commons schemas params from ('NotNull 'PGint4)
19471947 -- ^ numuckets
1948− -> WindowFunction commons schemas from grp params ('NotNull 'PGint4)
1948+ -> WindowFunction grp commons schemas params from ('NotNull 'PGint4)
19491949ntile numBuckets = UnsafeWindowFunction $ "ntile"
19501950 <> parenthesized (renderSQL numBuckets)
19511951
@@ -1955,13 +1955,13 @@ row within the partition; if there is no such row, instead return default
19551955evaluated with respect to the current row.
19561956-}
19571957lag
1958− :: Expression commons schemas from grp params ty
1958+ :: Expression grp commons schemas params from ty
19591959 -- ^ value
1960− -> Expression commons schemas from grp params ('NotNull 'PGint4)
1960+ -> Expression grp commons schemas params from ('NotNull 'PGint4)
19611961 -- ^ offset
1962− -> Expression commons schemas from grp params ty
1962+ -> Expression grp commons schemas params from ty
19631963 -- ^ default
1964− -> WindowFunction commons schemas from grp params ty
1964+ -> WindowFunction grp commons schemas params from ty
19651965lag value offset def = UnsafeWindowFunction $ "lag"
19661966 <> parenthesized
19671967 (commaSeparated ([renderSQL value, renderSQL offset, renderSQL def]))
@@ -1972,13 +1972,13 @@ row within the partition; if there is no such row, instead return default
19721972evaluated with respect to the current row.
19731973-}
19741974lead
1975− :: Expression commons schemas from grp params ty
1975+ :: Expression grp commons schemas params from ty
19761976 -- ^ value
1977− -> Expression commons schemas from grp params ('NotNull 'PGint4)
1977+ -> Expression grp commons schemas params from ('NotNull 'PGint4)
19781978 -- ^ offset
1979− -> Expression commons schemas from grp params ty
1979+ -> Expression grp commons schemas params from ty
19801980 -- ^ default
1981− -> WindowFunction commons schemas from grp params ty
1981+ -> WindowFunction grp commons schemas params from ty
19821982lead value offset def = UnsafeWindowFunction $ "lag"
19831983 <> parenthesized
19841984 (commaSeparated ([renderSQL value, renderSQL offset, renderSQL def]))
@@ -1987,9 +1987,9 @@ lead value offset def = UnsafeWindowFunction $ "lag"
19871987first row of the window frame
19881988-}
19891989firstValue
1990− :: Expression commons schemas from grp params ty
1990+ :: Expression grp commons schemas params from ty
19911991 -- ^ value
1992− -> WindowFunction commons schemas from grp params ty
1992+ -> WindowFunction grp commons schemas params from ty
19931993firstValue value = UnsafeWindowFunction $ "first_value"
19941994 <> parenthesized (renderSQL value)
19951995
@@ -1997,9 +1997,9 @@ firstValue value = UnsafeWindowFunction $ "first_value"
19971997last row of the window frame
19981998-}
19991999lastValue
2000− :: Expression commons schemas from grp params ty
2000+ :: Expression grp commons schemas params from ty
20012001 -- ^ value
2002− -> WindowFunction commons schemas from grp params ty
2002+ -> WindowFunction grp commons schemas params from ty
20032003lastValue value = UnsafeWindowFunction $ "last_value"
20042004 <> parenthesized (renderSQL value)
20052005
@@ -2007,10 +2007,10 @@ lastValue value = UnsafeWindowFunction $ "last_value"
20072007row of the window frame (counting from 1); null if no such row
20082008-}
20092009nthValue
2010− :: Expression commons schemas from grp params (nullity ty)
2010+ :: Expression grp commons schemas params from (nullity ty)
20112011 -- ^ value
2012− -> Expression commons schemas from grp params ('NotNull 'PGint4)
2012+ -> Expression grp commons schemas params from ('NotNull 'PGint4)
20132013 -- ^ nth
2014− -> WindowFunction commons schemas from grp params ('Null ty)
2014+ -> WindowFunction grp commons schemas params from ('Null ty)
20152015nthValue value nth = UnsafeWindowFunction $ "nth_value"
20162016 <> parenthesized (commaSeparated [renderSQL value, renderSQL nth])
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+36−36
@@ -263,13 +263,13 @@ insertInto_ tab qry =
263263data QueryClause commons schemas params columns where
264264 Values
265265 :: SOP.SListI columns
266− => NP (ColumnExpression schemas params 'Ungrouped '[]) columns
267− -> [NP (ColumnExpression schemas params 'Ungrouped '[]) columns]
266+ => NP (ColumnExpression 'Ungrouped schemas params '[]) columns
267+ -> [NP (ColumnExpression 'Ungrouped schemas params '[]) columns]
268268 -> QueryClause commons schemas params columns
269269 Select
270270 :: SOP.SListI columns
271− => NP (ColumnExpression schemas params grp from) columns
272− -> TableExpression commons schemas params grp from
271+ => NP (ColumnExpression grp schemas params from) columns
272+ -> TableExpression grp commons schemas params from
273273 -> QueryClause commons schemas params columns
274274 Subquery
275275 :: ColumnsToRow columns ~ row
@@ -292,7 +292,7 @@ instance RenderSQL (QueryClause commons schemas params columns) where
292292 Subquery qry -> renderQuery qry
293293 where
294294 renderSQLPartMaybe, renderValuePartMaybe
295− :: ColumnExpression schemas params grp from column -> Maybe ByteString
295+ :: ColumnExpression grp schemas params from column -> Maybe ByteString
296296 renderSQLPartMaybe = \case
297297 DefaultAs _ -> Nothing
298298 Specific (_ `As` name) -> Just $ renderSQL name
@@ -300,7 +300,7 @@ instance RenderSQL (QueryClause commons schemas params columns) where
300300 DefaultAs _ -> Nothing
301301 Specific (value `As` _) -> Just $ renderExpression value
302302 renderSQLPart, renderValuePart
303− :: ColumnExpression schemas params grp from column -> ByteString
303+ :: ColumnExpression grp schemas params from column -> ByteString
304304 renderSQLPart = \case
305305 DefaultAs name -> renderSQL name
306306 Specific (_ `As` name) -> renderSQL name
@@ -310,49 +310,49 @@ instance RenderSQL (QueryClause commons schemas params columns) where
310310
311311pattern Values_
312312 :: SOP.SListI columns
313− => NP (ColumnExpression schemas params 'Ungrouped '[]) columns
313+ => NP (ColumnExpression 'Ungrouped schemas params '[]) columns
314314 -> QueryClause commons schemas params columns
315315pattern Values_ vals = Values vals []
316316
317−data ColumnExpression schemas params grp from column where
317+data ColumnExpression grp schemas params from column where
318318 DefaultAs
319319 :: KnownSymbol col
320320 => Alias col
321− -> ColumnExpression schemas params grp from (col ::: 'Def :=> ty)
321+ -> ColumnExpression grp schemas params from (col ::: 'Def :=> ty)
322322 Specific
323− :: Aliased (Expression '[] schemas params grp from) (col ::: ty)
324− -> ColumnExpression schemas params grp from (col ::: defness :=> ty)
323+ :: Aliased (Expression grp '[] schemas params from) (col ::: ty)
324+ -> ColumnExpression grp schemas params from (col ::: defness :=> ty)
325325
326326instance (KnownSymbol col, column ~ (col ::: defness :=> ty))
327327 => Aliasable col
328− (Expression '[] schemas params grp from ty)
329− (ColumnExpression schemas params grp from column) where
328+ (Expression grp '[] schemas params from ty)
329+ (ColumnExpression grp schemas params from column) where
330330 expression `as` col = Specific (expression `As` col)
331331instance (KnownSymbol col, columns ~ '[col ::: defness :=> ty])
332332 => Aliasable col
333− (Expression '[] schemas params grp from ty)
334− (NP (ColumnExpression schemas params grp from) columns) where
333+ (Expression grp '[] schemas params from ty)
334+ (NP (ColumnExpression grp schemas params from) columns) where
335335 expression `as` col = expression `as` col :* Nil
336336instance (KnownSymbol col, column ~ (col ::: 'Def :=> ty))
337− => DefaultAliasable col (ColumnExpression schemas params grp from column) where
337+ => DefaultAliasable col (ColumnExpression grp schemas params from column) where
338338 defaultAs = DefaultAs
339339instance (KnownSymbol col, columns ~ '[col ::: 'Def :=> ty])
340− => DefaultAliasable col (NP (ColumnExpression schemas params grp from) columns) where
340+ => DefaultAliasable col (NP (ColumnExpression grp schemas params from) columns) where
341341 defaultAs col = defaultAs col :* Nil
342342
343343instance (HasUnique tab from row, Has col row ty, column ~ (col ::: defness :=> ty))
344− => IsLabel col (ColumnExpression schemas params 'Ungrouped from column) where
344+ => IsLabel col (ColumnExpression 'Ungrouped schemas params from column) where
345345 fromLabel = fromLabel @col `as` Alias
346346instance (HasUnique tab from row, Has col row ty, columns ~ '[col ::: defness :=> ty])
347347 => IsLabel col
348− (NP (ColumnExpression schemas params 'Ungrouped from) columns) where
348+ (NP (ColumnExpression 'Ungrouped schemas params from) columns) where
349349 fromLabel = fromLabel @col `as` Alias
350350
351351instance (Has tab from row, Has col row ty, column ~ (col ::: defness :=> ty))
352− => IsQualified tab col (ColumnExpression schemas params 'Ungrouped from column) where
352+ => IsQualified tab col (ColumnExpression 'Ungrouped schemas params from column) where
353353 tab ! col = tab ! col `as` col
354354instance (Has tab from row, Has col row ty, columns ~ '[col ::: defness :=> ty])
355− => IsQualified tab col (NP (ColumnExpression schemas params 'Ungrouped from) columns) where
355+ => IsQualified tab col (NP (ColumnExpression 'Ungrouped schemas params from) columns) where
356356 tab ! col = tab ! col `as` col
357357
358358instance
@@ -361,7 +361,7 @@ instance
361361 , GroupedBy tab col bys
362362 , column ~ (col ::: defness :=> ty)
363363 ) => IsLabel col
364− (ColumnExpression schemas params ('Grouped bys) from column) where
364+ (ColumnExpression ('Grouped bys) schemas params from column) where
365365 fromLabel = fromLabel @col `as` Alias
366366instance
367367 ( HasUnique tab from row
@@ -369,7 +369,7 @@ instance
369369 , GroupedBy tab col bys
370370 , columns ~ '[col ::: defness :=> ty]
371371 ) => IsLabel col
372− (NP (ColumnExpression schemas params ('Grouped bys) from) columns) where
372+ (NP (ColumnExpression ('Grouped bys) schemas params from) columns) where
373373 fromLabel = fromLabel @col `as` Alias
374374
375375instance
@@ -378,7 +378,7 @@ instance
378378 , GroupedBy tab col bys
379379 , column ~ (col ::: defness :=> ty)
380380 ) => IsQualified tab col
381− (ColumnExpression schemas params ('Grouped bys) from column) where
381+ (ColumnExpression ('Grouped bys) schemas params from column) where
382382 tab ! col = tab ! col `as` col
383383instance
384384 ( Has tab from row
@@ -386,10 +386,10 @@ instance
386386 , GroupedBy tab col bys
387387 , columns ~ '[col ::: defness :=> ty]
388388 ) => IsQualified tab col
389− (NP (ColumnExpression schemas params ('Grouped bys) from) columns) where
389+ (NP (ColumnExpression ('Grouped bys) schemas params from) columns) where
390390 tab ! col = tab ! col :* Nil
391391
392−instance RenderSQL (ColumnExpression schemas params grp from column) where
392+instance RenderSQL (ColumnExpression grp schemas params from column) where
393393 renderSQL = \case
394394 DefaultAs col ->
395395 renderSQL col <+> "=" <+> "DEFAULT"
@@ -407,7 +407,7 @@ instance RenderSQL (ColumnExpression schemas params grp from column) where
407407-- in the row. Use @Returning Nil@ in the common case where no return
408408-- values are desired.
409409newtype ReturningClause commons schemas params from row =
410− Returning (Selection commons schemas params 'Ungrouped from row)
410+ Returning (Selection 'Ungrouped commons schemas params from row)
411411
412412instance RenderSQL (ReturningClause commons schemas params from row) where
413413 renderSQL = \case
@@ -416,7 +416,7 @@ instance RenderSQL (ReturningClause commons schemas params from row) where
416416
417417pattern Returning_
418418 :: SOP.SListI row
419− => NP (Aliased (Expression commons schemas params 'Ungrouped from)) row
419+ => NP (Aliased (Expression 'Ungrouped commons schemas params from)) row
420420 -> ReturningClause commons schemas params from row
421421pattern Returning_ list = Returning (List list)
422422
@@ -448,8 +448,8 @@ data ConflictAction tab commons schemas params columns where
448448 , columns ~ (col0 ': cols)
449449 , SOP.All (HasIn columns) subcolumns
450450 , AllUnique subcolumns )
451− => NP (ColumnExpression schemas params 'Ungrouped '[tab ::: row, "excluded" ::: row]) subcolumns
452− -> [Condition commons schemas params 'Ungrouped '[tab ::: row, "excluded" ::: row]]
451+ => NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row, "excluded" ::: row]) subcolumns
452+ -> [Condition 'Ungrouped commons schemas params '[tab ::: row, "excluded" ::: row]]
453453 -> ConflictAction tab commons schemas params columns
454454
455455instance RenderSQL (ConflictAction tab commons schemas params columns) where
@@ -492,9 +492,9 @@ update
492492 , SOP.All (HasIn columns) subcolumns
493493 , AllUnique subcolumns )
494494 => QualifiedAlias sch tab -- ^ table to update
495− -> NP (ColumnExpression schemas params 'Ungrouped '[tab ::: row0]) subcolumns
495+ -> NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row0]) subcolumns
496496 -- ^ modified values to replace old values
497− -> Condition commons schemas params 'Ungrouped '[tab ::: row0]
497+ -> Condition 'Ungrouped commons schemas params '[tab ::: row0]
498498 -- ^ condition under which to perform update on a row
499499 -> ReturningClause commons schemas params '[tab ::: row0] row1 -- ^ results to return
500500 -> Manipulation commons schemas params row1
@@ -517,9 +517,9 @@ update_
517517 , SOP.All (HasIn columns) subcolumns
518518 , AllUnique subcolumns )
519519 => QualifiedAlias sch tab -- ^ table to update
520− -> NP (ColumnExpression schemas params 'Ungrouped '[tab ::: row]) subcolumns
520+ -> NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row]) subcolumns
521521 -- ^ modified values to replace old values
522− -> Condition commons schemas params 'Ungrouped '[tab ::: row]
522+ -> Condition 'Ungrouped commons schemas params '[tab ::: row]
523523 -- ^ condition under which to perform update on a row
524524 -> Manipulation commons schemas params '[]
525525update_ tab columns wh = update tab columns wh (Returning_ Nil)
@@ -544,7 +544,7 @@ deleteFrom
544544 , columns ~ TableToColumns table )
545545 => QualifiedAlias sch tab -- ^ table to delete from
546546 -> UsingClause commons schemas params from
547− -> Condition commons schemas params 'Ungrouped (tab ::: row0 ': from)
547+ -> Condition 'Ungrouped commons schemas params (tab ::: row0 ': from)
548548 -- ^ condition under which to delete a row
549549 -> ReturningClause commons schemas params '[tab ::: row0] row1 -- ^ results to return
550550 -> Manipulation commons schemas params row1
@@ -566,7 +566,7 @@ deleteFrom_
566566 , columns ~ TableToColumns table )
567567 => QualifiedAlias sch tab -- ^ table to delete from
568568 -> UsingClause commons schemas params from
569− -> Condition commons schemas params 'Ungrouped (tab ::: row ': from)
569+ -> Condition 'Ungrouped commons schemas params (tab ::: row ': from)
570570 -- ^ condition under which to delete a row
571571 -> Manipulation commons schemas params '[]
572572deleteFrom_ tab uses wh = deleteFrom tab uses wh (Returning_ Nil)
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+147−147
@@ -405,54 +405,54 @@ q1 `exceptAll` q2 = UnsafeQuery $
405405SELECT queries
406406-----------------------------------------}
407407
408−data Selection commons schemas params grp from row where
408+data Selection grp commons schemas params from row where
409409 List
410410 :: SListI row
411− => NP (Aliased (Expression commons schemas params grp from)) row
412− -> Selection commons schemas params grp from row
411+ => NP (Aliased (Expression grp commons schemas params from)) row
412+ -> Selection grp commons schemas params from row
413413 Star
414414 :: HasUnique tab from row
415− => Selection commons schemas params 'Ungrouped from row
415+ => Selection 'Ungrouped commons schemas params from row
416416 DotStar
417417 :: Has tab from row
418418 => Alias tab
419− -> Selection commons schemas params 'Ungrouped from row
419+ -> Selection 'Ungrouped commons schemas params from row
420420 Also
421− :: Selection commons schemas params grp from right
422− -> Selection commons schemas params grp from left
423− -> Selection commons schemas params grp from (Join left right)
421+ :: Selection grp commons schemas params from right
422+ -> Selection grp commons schemas params from left
423+ -> Selection grp commons schemas params from (Join left right)
424424 Over
425425 :: SListI row
426− => NP (Aliased (WindowFunction commons schemas params grp from)) row
427− -> WindowDefinition commons schemas params grp from
428− -> Selection commons schemas params grp from row
426+ => NP (Aliased (WindowFunction grp commons schemas params from)) row
427+ -> WindowDefinition grp commons schemas params from
428+ -> Selection grp commons schemas params from row
429429instance (KnownSymbol col, row ~ '[col ::: ty])
430430 => Aliasable col
431− (Expression commons schemas params grp from ty)
432− (Selection commons schemas params grp from row) where
431+ (Expression grp commons schemas params from ty)
432+ (Selection grp commons schemas params from row) where
433433 expr `as` col = List (expr `as` col)
434434instance (Has tab from row0, Has col row0 ty, row1 ~ '[col ::: ty])
435− => IsQualified tab col (Selection commons schemas params 'Ungrouped from row1) where
435+ => IsQualified tab col (Selection 'Ungrouped commons schemas params from row1) where
436436 tab ! col = tab ! col `as` col
437437instance
438438 ( Has tab from row0
439439 , Has col row0 ty
440440 , row1 ~ '[col ::: ty]
441441 , GroupedBy tab col bys )
442− => IsQualified tab col (Selection commons schemas params ('Grouped bys) from row1) where
442+ => IsQualified tab col (Selection ('Grouped bys) commons schemas params from row1) where
443443 tab ! col = tab ! col `as` col
444444instance (HasUnique tab from row0, Has col row0 ty, row1 ~ '[col ::: ty])
445− => IsLabel col (Selection commons schemas params 'Ungrouped from row1) where
445+ => IsLabel col (Selection 'Ungrouped commons schemas params from row1) where
446446 fromLabel = fromLabel @col `as` Alias
447447instance
448448 ( HasUnique tab from row0
449449 , Has col row0 ty
450450 , row1 ~ '[col ::: ty]
451451 , GroupedBy tab col bys )
452− => IsLabel col (Selection commons schemas params ('Grouped bys) from row1) where
452+ => IsLabel col (Selection ('Grouped bys) commons schemas params from row1) where
453453 fromLabel = fromLabel @col `as` Alias
454454
455−instance RenderSQL (Selection commons schemas params grp from row) where
455+instance RenderSQL (Selection grp commons schemas params from row) where
456456 renderSQL = \case
457457 List list -> renderCommaSeparated (renderAliased renderSQL) list
458458 Star -> "*"
@@ -461,7 +461,7 @@ instance RenderSQL (Selection commons schemas params grp from row) where
461461 Over winFns winDef ->
462462 let
463463 renderOver
464− :: Aliased (WindowFunction commons schemas params grp from) field
464+ :: Aliased (WindowFunction grp commons schemas params from) field
465465 -> ByteString
466466 renderOver (winFn `As` col) = renderSQL winFn
467467 <+> "OVER" <+> parenthesized (renderSQL winDef)
@@ -476,9 +476,9 @@ instance RenderSQL (Selection commons schemas params grp from row) where
476476-- the intermediate table are actually output.
477477select
478478 :: (SListI row, row ~ (x ': xs))
479− => Selection commons schemas params grp from row
479+ => Selection grp commons schemas params from row
480480 -- ^ select list
481− -> TableExpression commons schemas params grp from
481+ -> TableExpression grp commons schemas params from
482482 -- ^ intermediate virtual table
483483 -> Query commons schemas params row
484484select selection tabexpr = UnsafeQuery $
@@ -488,8 +488,8 @@ select selection tabexpr = UnsafeQuery $
488488
489489select_
490490 :: (SListI row, row ~ (x ': xs))
491− => NP (Aliased (Expression commons schemas params grp from)) row
492− -> TableExpression commons schemas params grp from
491+ => NP (Aliased (Expression grp commons schemas params from)) row
492+ -> TableExpression grp commons schemas params from
493493 -> Query commons schemas params row
494494select_ list = select (List list)
495495
@@ -497,9 +497,9 @@ select_ list = select (List list)
497497-- be subject to the elimination of duplicate rows using `selectDistinct`.
498498selectDistinct
499499 :: (SListI columns, columns ~ (col ': cols))
500− => Selection commons schemas params 'Ungrouped from columns
500+ => Selection 'Ungrouped commons schemas params from columns
501501 -- ^ select list
502− -> TableExpression commons schemas params 'Ungrouped from
502+ -> TableExpression 'Ungrouped commons schemas params from
503503 -- ^ intermediate virtual table
504504 -> Query commons schemas params columns
505505selectDistinct selection tabexpr = UnsafeQuery $
@@ -509,9 +509,9 @@ selectDistinct selection tabexpr = UnsafeQuery $
509509
510510selectDistinct_
511511 :: (SListI columns, columns ~ (col ': cols))
512− => NP (Aliased (Expression commons schemas params 'Ungrouped from)) columns
512+ => NP (Aliased (Expression 'Ungrouped commons schemas params from)) columns
513513 -- ^ select list
514− -> TableExpression commons schemas params 'Ungrouped from
514+ -> TableExpression 'Ungrouped commons schemas params from
515515 -- ^ intermediate virtual table
516516 -> Query commons schemas params columns
517517selectDistinct_ list = select (List list)
@@ -527,8 +527,8 @@ selectDistinct_ list = select (List list)
527527-- SELECT * FROM (VALUES (1, E'one')) AS t ("a", "b")
528528values
529529 :: SListI cols
530− => NP (Aliased (Expression commons schemas params 'Ungrouped '[] )) cols
531− -> [NP (Aliased (Expression commons schemas params 'Ungrouped '[] )) cols]
530+ => NP (Aliased (Expression 'Ungrouped commons schemas params '[] )) cols
531+ -> [NP (Aliased (Expression 'Ungrouped commons schemas params '[] )) cols]
532532 -- ^ When more than one row is specified, all the rows must
533533 -- must have the same number of elements
534534 -> Query commons schemas params cols
@@ -542,7 +542,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
542542 <+> parenthesized (renderCommaSeparated renderAliasPart rw)
543543 where
544544 renderAliasPart, renderValuePart
545− :: Aliased (Expression commons schemas params 'Ungrouped '[] ) ty -> ByteString
545+ :: Aliased (Expression 'Ungrouped commons schemas params '[] ) ty -> ByteString
546546 renderAliasPart (_ `As` name) = renderSQL name
547547 renderValuePart (value `As` _) = renderSQL value
548548
@@ -550,7 +550,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
550550-- specified by value expressions.
551551values_
552552 :: SListI cols
553− => NP (Aliased (Expression commons schemas params 'Ungrouped '[] )) cols
553+ => NP (Aliased (Expression 'Ungrouped commons schemas params '[] )) cols
554554 -- ^ one row of values
555555 -> Query commons schemas params cols
556556values_ rw = values rw []
@@ -566,16 +566,16 @@ Table Expressions
566566-- to a table on disk, a so-called base table, but more complex expressions
567567-- can be used to modify or combine base tables in various ways.
568568data TableExpression
569+ (grp :: Grouping)
569570 (commons :: FromType)
570571 (schemas :: SchemasType)
571572 (params :: [NullityType])
572− (grp :: Grouping)
573573 (from :: FromType)
574574 = TableExpression
575575 { fromClause :: FromClause commons schemas params from
576576 -- ^ A table reference that can be a table name, or a derived table such
577577 -- as a subquery, a @JOIN@ construct, or complex combinations of these.
578− , whereClause :: [Condition commons schemas params 'Ungrouped from]
578+ , whereClause :: [Condition 'Ungrouped commons schemas params from]
579579 -- ^ optional search coditions, combined with `.&&`. After the processing
580580 -- of the `fromClause` is done, each row of the derived virtual table
581581 -- is checked against the search condition. If the result of the
@@ -591,13 +591,13 @@ data TableExpression
591591 -- set of rows having common values into one group row that represents all
592592 -- rows in the group. This is done to eliminate redundancy in the output
593593 -- and/or compute aggregates that apply to these groups.
594− , havingClause :: HavingClause commons schemas params grp from
594+ , havingClause :: HavingClause grp commons schemas params from
595595 -- ^ If a table has been grouped using `groupBy`, but only certain groups
596596 -- are of interest, the `havingClause` can be used, much like a
597597 -- `whereClause`, to eliminate groups from the result. Expressions in the
598598 -- `havingClause` can refer both to grouped expressions and to ungrouped
599599 -- expressions (which necessarily involve an aggregate function).
600− , orderByClause :: [SortExpression commons schemas params grp from]
600+ , orderByClause :: [SortExpression grp commons schemas params from]
601601 -- ^ The `orderByClause` is for optional sorting. When more than one
602602 -- `SortExpression` is specified, the later (right) values are used to sort
603603 -- rows that are equal according to the earlier (left) values.
@@ -614,7 +614,7 @@ data TableExpression
614614 }
615615
616616-- | Render a `TableExpression`
617−instance RenderSQL (TableExpression commons schemas params grp from) where
617+instance RenderSQL (TableExpression grp commons schemas params from) where
618618 renderSQL
619619 (TableExpression frm' whs' grps' hvs' srts' lims' offs') = mconcat
620620 [ "FROM ", renderSQL frm'
@@ -648,15 +648,15 @@ instance RenderSQL (TableExpression commons schemas params grp from) where
648648-- to match the left-to-right sequencing of their placement in SQL.
649649from
650650 :: FromClause commons schemas params from -- ^ table reference
651− -> TableExpression commons schemas params 'Ungrouped from
651+ -> TableExpression 'Ungrouped commons schemas params from
652652from rels = TableExpression rels [] NoGroups NoHaving [] [] []
653653
654654-- | A `where_` is an endomorphism of `TableExpression`s which adds a
655655-- search condition to the `whereClause`.
656656where_
657− :: Condition commons schemas params 'Ungrouped from -- ^ filtering condition
658− -> TableExpression commons schemas params grp from
659− -> TableExpression commons schemas params grp from
657+ :: Condition 'Ungrouped commons schemas params from -- ^ filtering condition
658+ -> TableExpression grp commons schemas params from
659+ -> TableExpression grp commons schemas params from
660660where_ wh rels = rels {whereClause = wh : whereClause rels}
661661
662662-- | A `groupBy` is a transformation of `TableExpression`s which switches
@@ -665,8 +665,8 @@ where_ wh rels = rels {whereClause = wh : whereClause rels}
665665groupBy
666666 :: SListI bys
667667 => NP (By from) bys -- ^ grouped columns
668− -> TableExpression commons schemas params 'Ungrouped from
669− -> TableExpression commons schemas params ('Grouped bys) from
668+ -> TableExpression 'Ungrouped commons schemas params from
669+ -> TableExpression ('Grouped bys) commons schemas params from
670670groupBy bys rels = TableExpression
671671 { fromClause = fromClause rels
672672 , whereClause = whereClause rels
@@ -680,9 +680,9 @@ groupBy bys rels = TableExpression
680680-- | A `having` is an endomorphism of `TableExpression`s which adds a
681681-- search condition to the `havingClause`.
682682having
683− :: Condition commons schemas params ('Grouped bys) from -- ^ having condition
684− -> TableExpression commons schemas params ('Grouped bys) from
685− -> TableExpression commons schemas params ('Grouped bys) from
683+ :: Condition ('Grouped bys) commons schemas params from -- ^ having condition
684+ -> TableExpression ('Grouped bys) commons schemas params from
685+ -> TableExpression ('Grouped bys) commons schemas params from
686686having hv rels = rels
687687 { havingClause = case havingClause rels of Having hvs -> Having (hv:hvs) }
688688
@@ -693,16 +693,16 @@ instance OrderBy TableExpression where
693693-- `limitClause`.
694694limit
695695 :: Word64 -- ^ limit parameter
696− -> TableExpression commons schemas params grp from
697− -> TableExpression commons schemas params grp from
696+ -> TableExpression grp commons schemas params from
697+ -> TableExpression grp commons schemas params from
698698limit lim rels = rels {limitClause = lim : limitClause rels}
699699
700700-- | An `offset` is an endomorphism of `TableExpression`s which adds to the
701701-- `offsetClause`.
702702offset
703703 :: Word64 -- ^ offset parameter
704− -> TableExpression commons schemas params grp from
705− -> TableExpression commons schemas params grp from
704+ -> TableExpression grp commons schemas params from
705+ -> TableExpression grp commons schemas params from
706706offset off rels = rels {offsetClause = off : offsetClause rels}
707707
708708{-----------------------------------------
@@ -711,55 +711,55 @@ JSON stuff
711711
712712unsafeSetOfFunction
713713 :: ByteString
714− -> Expression commons schemas params 'Ungrouped '[] ty
714+ -> Expression 'Ungrouped commons schemas params '[] ty
715715 -> Query commons schemas params row
716716unsafeSetOfFunction fun expr = UnsafeQuery $
717717 "SELECT * FROM " <> fun <> "(" <> renderSQL expr <> ")"
718718
719719-- | Expands the outermost JSON object into a set of key/value pairs.
720720jsonEach
721− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json object
721+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
722722 -> Query commons schemas params
723723 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson]
724724jsonEach = unsafeSetOfFunction "json_each"
725725
726726-- | Expands the outermost binary JSON object into a set of key/value pairs.
727727jsonbEach
728− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb object
728+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
729729 -> Query commons schemas params
730730 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjsonb]
731731jsonbEach = unsafeSetOfFunction "jsonb_each"
732732
733733-- | Expands the outermost JSON object into a set of key/value pairs.
734734jsonEachAsText
735− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json object
735+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
736736 -> Query commons schemas params
737737 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
738738jsonEachAsText = unsafeSetOfFunction "json_each_text"
739739
740740-- | Expands the outermost binary JSON object into a set of key/value pairs.
741741jsonbEachAsText
742− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb object
742+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
743743 -> Query commons schemas params
744744 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
745745jsonbEachAsText = unsafeSetOfFunction "jsonb_each_text"
746746
747747-- | Returns set of keys in the outermost JSON object.
748748jsonObjectKeys
749− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json object
749+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
750750 -> Query commons schemas params '["json_object_keys" ::: 'NotNull 'PGtext]
751751jsonObjectKeys = unsafeSetOfFunction "json_object_keys"
752752
753753-- | Returns set of keys in the outermost JSON object.
754754jsonbObjectKeys
755− :: Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb object
755+ :: Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
756756 -> Query commons schemas params '["jsonb_object_keys" ::: 'NotNull 'PGtext]
757757jsonbObjectKeys = unsafeSetOfFunction "jsonb_object_keys"
758758
759759unsafePopulateFunction
760760 :: ByteString
761761 -> TypeExpression schemas (nullity ('PGcomposite row))
762− -> Expression commons schemas params 'Ungrouped '[] ty
762+ -> Expression 'Ungrouped commons schemas params '[] ty
763763 -> Query commons schemas params row
764764unsafePopulateFunction fun ty expr = UnsafeQuery $
765765 "SELECT * FROM " <> fun <> "("
@@ -770,7 +770,7 @@ unsafePopulateFunction fun ty expr = UnsafeQuery $
770770-- type defined by the given table.
771771jsonPopulateRecord
772772 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
773− -> Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json object
773+ -> Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
774774 -> Query commons schemas params row
775775jsonPopulateRecord = unsafePopulateFunction "json_populate_record"
776776
@@ -778,7 +778,7 @@ jsonPopulateRecord = unsafePopulateFunction "json_populate_record"
778778-- type defined by the given table.
779779jsonbPopulateRecord
780780 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
781− -> Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb object
781+ -> Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
782782 -> Query commons schemas params row
783783jsonbPopulateRecord = unsafePopulateFunction "jsonb_populate_record"
784784
@@ -786,7 +786,7 @@ jsonbPopulateRecord = unsafePopulateFunction "jsonb_populate_record"
786786-- set of rows whose columns match the record type defined by the given table.
787787jsonPopulateRecordSet
788788 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
789− -> Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json array
789+ -> Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json array
790790 -> Query commons schemas params row
791791jsonPopulateRecordSet = unsafePopulateFunction "json_populate_record_set"
792792
@@ -795,14 +795,14 @@ jsonPopulateRecordSet = unsafePopulateFunction "json_populate_record_set"
795795-- table.
796796jsonbPopulateRecordSet
797797 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
798− -> Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb array
798+ -> Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
799799 -> Query commons schemas params row
800800jsonbPopulateRecordSet = unsafePopulateFunction "jsonb_populate_record_set"
801801
802802unsafeRecordFunction
803803 :: (SListI record, json `In` PGJsonType)
804804 => ByteString
805− -> Expression commons schemas params 'Ungrouped '[] (nullity json)
805+ -> Expression 'Ungrouped commons schemas params '[] (nullity json)
806806 -> NP (Aliased (TypeExpression schemas)) record
807807 -> Query commons schemas params record
808808unsafeRecordFunction fun expr types = UnsafeQuery $
@@ -817,7 +817,7 @@ unsafeRecordFunction fun expr types = UnsafeQuery $
817817-- | Builds an arbitrary record from a JSON object.
818818jsonToRecord
819819 :: SListI record
820− => Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json object
820+ => Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
821821 -> NP (Aliased (TypeExpression schemas)) record -- ^ record types
822822 -> Query commons schemas params record
823823jsonToRecord = unsafeRecordFunction "json_to_record"
@@ -825,7 +825,7 @@ jsonToRecord = unsafeRecordFunction "json_to_record"
825825-- | Builds an arbitrary record from a binary JSON object.
826826jsonbToRecord
827827 :: SListI record
828− => Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb object
828+ => Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
829829 -> NP (Aliased (TypeExpression schemas)) record -- ^ record types
830830 -> Query commons schemas params record
831831jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
@@ -833,7 +833,7 @@ jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
833833-- | Builds an arbitrary set of records from a JSON array of objects.
834834jsonToRecordSet
835835 :: SListI record
836− => Expression commons schemas params 'Ungrouped '[] (nullity 'PGjson) -- ^ json array
836+ => Expression 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json array
837837 -> NP (Aliased (TypeExpression schemas)) record -- ^ record types
838838 -> Query commons schemas params record
839839jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
@@ -841,7 +841,7 @@ jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
841841-- | Builds an arbitrary set of records from a binary JSON array of objects.
842842jsonbToRecordSet
843843 :: SListI record
844− => Expression commons schemas params 'Ungrouped '[] (nullity 'PGjsonb) -- ^ jsonb array
844+ => Expression 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
845845 -> NP (Aliased (TypeExpression schemas)) record -- ^ record types
846846 -> Query commons schemas params record
847847jsonbToRecordSet = unsafeRecordFunction "jsonb_to_record_set"
@@ -910,7 +910,7 @@ the @on@ condition.
910910innerJoin
911911 :: FromClause commons schemas params right
912912 -- ^ right
913− -> Condition commons schemas params 'Ungrouped (Join left right)
913+ -> Condition 'Ungrouped commons schemas params (Join left right)
914914 -- ^ @on@ condition
915915 -> FromClause commons schemas params left
916916 -- ^ left
@@ -927,7 +927,7 @@ innerJoin right on left = UnsafeFromClause $
927927leftOuterJoin
928928 :: FromClause commons schemas params right
929929 -- ^ right
930− -> Condition commons schemas params 'Ungrouped (Join left right)
930+ -> Condition 'Ungrouped commons schemas params (Join left right)
931931 -- ^ @on@ condition
932932 -> FromClause commons schemas params left
933933 -- ^ left
@@ -945,7 +945,7 @@ leftOuterJoin right on left = UnsafeFromClause $
945945rightOuterJoin
946946 :: FromClause commons schemas params right
947947 -- ^ right
948− -> Condition commons schemas params 'Ungrouped (Join left right)
948+ -> Condition 'Ungrouped commons schemas params (Join left right)
949949 -- ^ @on@ condition
950950 -> FromClause commons schemas params left
951951 -- ^ left
@@ -964,7 +964,7 @@ rightOuterJoin right on left = UnsafeFromClause $
964964fullOuterJoin
965965 :: FromClause commons schemas params right
966966 -- ^ right
967− -> Condition commons schemas params 'Ungrouped (Join left right)
967+ -> Condition 'Ungrouped commons schemas params (Join left right)
968968 -- ^ @on@ condition
969969 -> FromClause commons schemas params left
970970 -- ^ left
@@ -1037,17 +1037,17 @@ instance RenderSQL (GroupByClause grp from) where
10371037-- An `Ungrouped` `TableExpression` may only use `NoHaving` while a `Grouped`
10381038-- `TableExpression` must use `Having` whose conditions are combined with
10391039-- `.&&`.
1040−data HavingClause commons schemas params grp from where
1041− NoHaving :: HavingClause commons schemas params 'Ungrouped from
1040+data HavingClause grp commons schemas params from where
1041+ NoHaving :: HavingClause 'Ungrouped commons schemas params from
10421042 Having
1043− :: [Condition commons schemas params ('Grouped bys) from]
1044− -> HavingClause commons schemas params ('Grouped bys) from
1045−deriving instance Show (HavingClause commons schemas params grp from)
1046−deriving instance Eq (HavingClause commons schemas params grp from)
1047−deriving instance Ord (HavingClause commons schemas params grp from)
1043+ :: [Condition ('Grouped bys) commons schemas params from]
1044+ -> HavingClause ('Grouped bys) commons schemas params from
1045+deriving instance Show (HavingClause grp commons schemas params from)
1046+deriving instance Eq (HavingClause grp commons schemas params from)
1047+deriving instance Ord (HavingClause grp commons schemas params from)
10481048
10491049-- | Render a `HavingClause`.
1050−instance RenderSQL (HavingClause commons schemas params grp from) where
1050+instance RenderSQL (HavingClause grp commons schemas params from) where
10511051 renderSQL = \case
10521052 NoHaving -> ""
10531053 Having [] -> ""
@@ -1056,18 +1056,18 @@ instance RenderSQL (HavingClause commons schemas params grp from) where
10561056
10571057unsafeSubqueryExpression
10581058 :: ByteString
1059− -> Expression commons schemas params grp from ty
1059+ -> Expression grp commons schemas params from ty
10601060 -> Query commons schemas params '[alias ::: ty]
1061− -> Expression commons schemas params grp from (nullity 'PGbool)
1061+ -> Expression grp commons schemas params from (nullity 'PGbool)
10621062unsafeSubqueryExpression op x q = UnsafeExpression $
10631063 renderSQL x <+> op <+> parenthesized (renderSQL q)
10641064
10651065unsafeRowSubqueryExpression
10661066 :: SListI row
10671067 => ByteString
1068− -> NP (Aliased (Expression commons schemas params grp from)) row
1068+ -> NP (Aliased (Expression grp commons schemas params from)) row
10691069 -> Query commons schemas params row
1070− -> Expression commons schemas params grp from (nullity 'PGbool)
1070+ -> Expression grp commons schemas params from (nullity 'PGbool)
10711071unsafeRowSubqueryExpression op xs q = UnsafeExpression $
10721072 renderSQL (row xs) <+> op <+> parenthesized (renderSQL q)
10731073
@@ -1080,9 +1080,9 @@ unsafeRowSubqueryExpression op xs q = UnsafeExpression $
10801080-- >>> printSQL $ true `in_` values_ (true `as` #foo)
10811081-- TRUE IN (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
10821082in_
1083− :: Expression commons schemas params grp from ty -- ^ expression
1083+ :: Expression grp commons schemas params from ty -- ^ expression
10841084 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1085− -> Expression commons schemas params grp from (nullity 'PGbool)
1085+ -> Expression grp commons schemas params from (nullity 'PGbool)
10861086in_ = unsafeSubqueryExpression "IN"
10871087
10881088{- | The left-hand side of this form of `rowIn` is a row constructor.
@@ -1095,231 +1095,231 @@ is `true` if any equal subquery row is found.
10951095The result is `false` if no equal row is found
10961096(including the case where the subquery returns no rows).
10971097
1098−>>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1098+>>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
10991099>>> printSQL $ myRow `rowIn` values_ myRow
11001100ROW(1, FALSE) IN (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11011101-}
11021102rowIn
11031103 :: SListI row
1104− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1104+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11051105 -> Query commons schemas params row -- ^ subquery
1106− -> Expression commons schemas params grp from (nullity 'PGbool)
1106+ -> Expression grp commons schemas params from (nullity 'PGbool)
11071107rowIn = unsafeRowSubqueryExpression "IN"
11081108
11091109-- | >>> printSQL $ true `eqAll` values_ (true `as` #foo)
11101110-- TRUE = ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
11111111eqAll
1112− :: Expression commons schemas params grp from ty -- ^ expression
1112+ :: Expression grp commons schemas params from ty -- ^ expression
11131113 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1114− -> Expression commons schemas params grp from (nullity 'PGbool)
1114+ -> Expression grp commons schemas params from (nullity 'PGbool)
11151115eqAll = unsafeSubqueryExpression "= ALL"
11161116
1117−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1117+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11181118-- >>> printSQL $ myRow `rowEqAll` values_ myRow
11191119-- ROW(1, FALSE) = ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11201120rowEqAll
11211121 :: SListI row
1122− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1122+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11231123 -> Query commons schemas params row -- ^ subquery
1124− -> Expression commons schemas params grp from (nullity 'PGbool)
1124+ -> Expression grp commons schemas params from (nullity 'PGbool)
11251125rowEqAll = unsafeRowSubqueryExpression "= ALL"
11261126
11271127-- | >>> printSQL $ true `eqAny` values_ (true `as` #foo)
11281128-- TRUE = ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
11291129eqAny
1130− :: Expression commons schemas params grp from ty -- ^ expression
1130+ :: Expression grp commons schemas params from ty -- ^ expression
11311131 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1132− -> Expression commons schemas params grp from (nullity 'PGbool)
1132+ -> Expression grp commons schemas params from (nullity 'PGbool)
11331133eqAny = unsafeSubqueryExpression "= ANY"
11341134
1135−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1135+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11361136-- >>> printSQL $ myRow `rowEqAny` values_ myRow
11371137-- ROW(1, FALSE) = ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11381138rowEqAny
11391139 :: SListI row
1140− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1140+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11411141 -> Query commons schemas params row -- ^ subquery
1142− -> Expression commons schemas params grp from (nullity 'PGbool)
1142+ -> Expression grp commons schemas params from (nullity 'PGbool)
11431143rowEqAny = unsafeRowSubqueryExpression "= ANY"
11441144
11451145-- | >>> printSQL $ true `neqAll` values_ (true `as` #foo)
11461146-- TRUE <> ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
11471147neqAll
1148− :: Expression commons schemas params grp from ty -- ^ expression
1148+ :: Expression grp commons schemas params from ty -- ^ expression
11491149 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1150− -> Expression commons schemas params grp from (nullity 'PGbool)
1150+ -> Expression grp commons schemas params from (nullity 'PGbool)
11511151neqAll = unsafeSubqueryExpression "<> ALL"
11521152
1153−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1153+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11541154-- >>> printSQL $ myRow `rowNeqAll` values_ myRow
11551155-- ROW(1, FALSE) <> ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11561156rowNeqAll
11571157 :: SListI row
1158− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1158+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11591159 -> Query commons schemas params row -- ^ subquery
1160− -> Expression commons schemas params grp from (nullity 'PGbool)
1160+ -> Expression grp commons schemas params from (nullity 'PGbool)
11611161rowNeqAll = unsafeRowSubqueryExpression "<> ALL"
11621162
11631163-- | >>> printSQL $ true `neqAny` values_ (true `as` #foo)
11641164-- TRUE <> ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
11651165neqAny
1166− :: Expression commons schemas params grp from ty -- ^ expression
1166+ :: Expression grp commons schemas params from ty -- ^ expression
11671167 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1168− -> Expression commons schemas params grp from (nullity 'PGbool)
1168+ -> Expression grp commons schemas params from (nullity 'PGbool)
11691169neqAny = unsafeSubqueryExpression "<> ANY"
11701170
1171−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1171+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11721172-- >>> printSQL $ myRow `rowNeqAny` values_ myRow
11731173-- ROW(1, FALSE) <> ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11741174rowNeqAny
11751175 :: SListI row
1176− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1176+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11771177 -> Query commons schemas params row -- ^ subquery
1178− -> Expression commons schemas params grp from (nullity 'PGbool)
1178+ -> Expression grp commons schemas params from (nullity 'PGbool)
11791179rowNeqAny = unsafeRowSubqueryExpression "<> ANY"
11801180
11811181-- | >>> printSQL $ true `allLt` values_ (true `as` #foo)
11821182-- TRUE ALL < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
11831183allLt
1184− :: Expression commons schemas params grp from ty -- ^ expression
1184+ :: Expression grp commons schemas params from ty -- ^ expression
11851185 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1186− -> Expression commons schemas params grp from (nullity 'PGbool)
1186+ -> Expression grp commons schemas params from (nullity 'PGbool)
11871187allLt = unsafeSubqueryExpression "ALL <"
11881188
1189−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1189+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11901190-- >>> printSQL $ myRow `rowLtAll` values_ myRow
11911191-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11921192rowLtAll
11931193 :: SListI row
1194− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1194+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
11951195 -> Query commons schemas params row -- ^ subquery
1196− -> Expression commons schemas params grp from (nullity 'PGbool)
1196+ -> Expression grp commons schemas params from (nullity 'PGbool)
11971197rowLtAll = unsafeRowSubqueryExpression "ALL <"
11981198
11991199-- | >>> printSQL $ true `ltAny` values_ (true `as` #foo)
12001200-- TRUE ANY < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12011201ltAny
1202− :: Expression commons schemas params grp from ty -- ^ expression
1202+ :: Expression grp commons schemas params from ty -- ^ expression
12031203 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1204− -> Expression commons schemas params grp from (nullity 'PGbool)
1204+ -> Expression grp commons schemas params from (nullity 'PGbool)
12051205ltAny = unsafeSubqueryExpression "ANY <"
12061206
1207−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1207+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12081208-- >>> printSQL $ myRow `rowLtAll` values_ myRow
12091209-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12101210rowLtAny
12111211 :: SListI row
1212− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1212+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
12131213 -> Query commons schemas params row -- ^ subquery
1214− -> Expression commons schemas params grp from (nullity 'PGbool)
1214+ -> Expression grp commons schemas params from (nullity 'PGbool)
12151215rowLtAny = unsafeRowSubqueryExpression "ANY <"
12161216
12171217-- | >>> printSQL $ true `lteAll` values_ (true `as` #foo)
12181218-- TRUE <= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12191219lteAll
1220− :: Expression commons schemas params grp from ty -- ^ expression
1220+ :: Expression grp commons schemas params from ty -- ^ expression
12211221 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1222− -> Expression commons schemas params grp from (nullity 'PGbool)
1222+ -> Expression grp commons schemas params from (nullity 'PGbool)
12231223lteAll = unsafeSubqueryExpression "<= ALL"
12241224
1225−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1225+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12261226-- >>> printSQL $ myRow `rowLteAll` values_ myRow
12271227-- ROW(1, FALSE) <= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12281228rowLteAll
12291229 :: SListI row
1230− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1230+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
12311231 -> Query commons schemas params row -- ^ subquery
1232− -> Expression commons schemas params grp from (nullity 'PGbool)
1232+ -> Expression grp commons schemas params from (nullity 'PGbool)
12331233rowLteAll = unsafeRowSubqueryExpression "<= ALL"
12341234
12351235-- | >>> printSQL $ true `lteAny` values_ (true `as` #foo)
12361236-- TRUE <= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12371237lteAny
1238− :: Expression commons schemas params grp from ty -- ^ expression
1238+ :: Expression grp commons schemas params from ty -- ^ expression
12391239 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1240− -> Expression commons schemas params grp from (nullity 'PGbool)
1240+ -> Expression grp commons schemas params from (nullity 'PGbool)
12411241lteAny = unsafeSubqueryExpression "<= ANY"
12421242
1243−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1243+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12441244-- >>> printSQL $ myRow `rowLteAny` values_ myRow
12451245-- ROW(1, FALSE) <= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12461246rowLteAny
12471247 :: SListI row
1248− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1248+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
12491249 -> Query commons schemas params row -- ^ subquery
1250− -> Expression commons schemas params grp from (nullity 'PGbool)
1250+ -> Expression grp commons schemas params from (nullity 'PGbool)
12511251rowLteAny = unsafeRowSubqueryExpression "<= ANY"
12521252
12531253-- | >>> printSQL $ true `gtAll` values_ (true `as` #foo)
12541254-- TRUE > ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12551255gtAll
1256− :: Expression commons schemas params grp from ty -- ^ expression
1256+ :: Expression grp commons schemas params from ty -- ^ expression
12571257 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1258− -> Expression commons schemas params grp from (nullity 'PGbool)
1258+ -> Expression grp commons schemas params from (nullity 'PGbool)
12591259gtAll = unsafeSubqueryExpression "> ALL"
12601260
1261−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1261+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12621262-- >>> printSQL $ myRow `rowGtAll` values_ myRow
12631263-- ROW(1, FALSE) > ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12641264rowGtAll
12651265 :: SListI row
1266− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1266+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
12671267 -> Query commons schemas params row -- ^ subquery
1268− -> Expression commons schemas params grp from (nullity 'PGbool)
1268+ -> Expression grp commons schemas params from (nullity 'PGbool)
12691269rowGtAll = unsafeRowSubqueryExpression "> ALL"
12701270
12711271-- | >>> printSQL $ true `gtAny` values_ (true `as` #foo)
12721272-- TRUE > ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12731273gtAny
1274− :: Expression commons schemas params grp from ty -- ^ expression
1274+ :: Expression grp commons schemas params from ty -- ^ expression
12751275 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1276− -> Expression commons schemas params grp from (nullity 'PGbool)
1276+ -> Expression grp commons schemas params from (nullity 'PGbool)
12771277gtAny = unsafeSubqueryExpression "> ANY"
12781278
1279−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1279+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12801280-- >>> printSQL $ myRow `rowGtAny` values_ myRow
12811281-- ROW(1, FALSE) > ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12821282rowGtAny
12831283 :: SListI row
1284− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1284+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
12851285 -> Query commons schemas params row -- ^ subquery
1286− -> Expression commons schemas params grp from (nullity 'PGbool)
1286+ -> Expression grp commons schemas params from (nullity 'PGbool)
12871287rowGtAny = unsafeRowSubqueryExpression "> ANY"
12881288
12891289-- | >>> printSQL $ true `gteAll` values_ (true `as` #foo)
12901290-- TRUE >= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
12911291gteAll
1292− :: Expression commons schemas params grp from ty -- ^ expression
1292+ :: Expression grp commons schemas params from ty -- ^ expression
12931293 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1294− -> Expression commons schemas params grp from (nullity 'PGbool)
1294+ -> Expression grp commons schemas params from (nullity 'PGbool)
12951295gteAll = unsafeSubqueryExpression ">= ALL"
12961296
1297−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1297+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12981298-- >>> printSQL $ myRow `rowGteAll` values_ myRow
12991299-- ROW(1, FALSE) >= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13001300rowGteAll
13011301 :: SListI row
1302− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1302+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
13031303 -> Query commons schemas params row -- ^ subquery
1304− -> Expression commons schemas params grp from (nullity 'PGbool)
1304+ -> Expression grp commons schemas params from (nullity 'PGbool)
13051305rowGteAll = unsafeRowSubqueryExpression ">= ALL"
13061306
13071307-- | >>> printSQL $ true `gteAny` values_ (true `as` #foo)
13081308-- TRUE >= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
13091309gteAny
1310− :: Expression commons schemas params grp from ty -- ^ expression
1310+ :: Expression grp commons schemas params from ty -- ^ expression
13111311 -> Query commons schemas params '[alias ::: ty] -- ^ subquery
1312− -> Expression commons schemas params grp from (nullity 'PGbool)
1312+ -> Expression grp commons schemas params from (nullity 'PGbool)
13131313gteAny = unsafeSubqueryExpression ">= ANY"
13141314
1315−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression commons schemas params grp from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1315+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression grp commons schemas params from)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
13161316-- >>> printSQL $ myRow `rowGteAny` values_ myRow
13171317-- ROW(1, FALSE) >= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13181318rowGteAny
13191319 :: SListI row
1320− => NP (Aliased (Expression commons schemas params grp from)) row -- ^ row constructor
1320+ => NP (Aliased (Expression grp commons schemas params from)) row -- ^ row constructor
13211321 -> Query commons schemas params row -- ^ subquery
1322− -> Expression commons schemas params grp from (nullity 'PGbool)
1322+ -> Expression grp commons schemas params from (nullity 'PGbool)
13231323rowGteAny = unsafeRowSubqueryExpression ">= ANY"
13241324
13251325-- | A `CommonTableExpression` is an auxiliary statement in a `with` clause.