on dev help sign in
schema ~> db
09b16fdEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+154−154
@@ -469,7 +469,7 @@ selectDistinct list rels = UnsafeQuery $
469-- that the table expression produces.
469-- that the table expression produces.
470selectStar
470selectStar
471 :: HasUnique table from columns
471 :: HasUnique table from columns
472− => TableExpression schema params from 'Ungrouped
472+ => TableExpression db params from 'Ungrouped
473 -- ^ intermediate virtual table
473 -- ^ intermediate virtual table
474 -> Query db params columns
474 -> Query db params columns
475selectStar rels = UnsafeQuery $ "SELECT" <+> "*" <+> renderTableExpression rels
475selectStar rels = UnsafeQuery $ "SELECT" <+> "*" <+> renderTableExpression rels
@@ -478,7 +478,7 @@ selectStar rels = UnsafeQuery $ "SELECT" <+> "*" <+> renderTableExpression rels
478-- produces and eliminates duplicate rows.
478-- produces and eliminates duplicate rows.
479selectDistinctStar
479selectDistinctStar
480 :: HasUnique table from columns
480 :: HasUnique table from columns
481− => TableExpression schema params from 'Ungrouped
481+ => TableExpression db params from 'Ungrouped
482 -- ^ intermediate virtual table
482 -- ^ intermediate virtual table
483 -> Query db params columns
483 -> Query db params columns
484selectDistinctStar rels = UnsafeQuery $
484selectDistinctStar rels = UnsafeQuery $
@@ -490,7 +490,7 @@ selectDotStar
490 :: Has table from columns
490 :: Has table from columns
491 => Alias table
491 => Alias table
492 -- ^ particular virtual subtable
492 -- ^ particular virtual subtable
493− -> TableExpression schema params from 'Ungrouped
493+ -> TableExpression db params from 'Ungrouped
494 -- ^ intermediate virtual table
494 -- ^ intermediate virtual table
495 -> Query db params columns
495 -> Query db params columns
496selectDotStar rel tab = UnsafeQuery $
496selectDotStar rel tab = UnsafeQuery $
@@ -502,7 +502,7 @@ selectDistinctDotStar
502 :: Has table from columns
502 :: Has table from columns
503 => Alias table
503 => Alias table
504 -- ^ particular virtual table
504 -- ^ particular virtual table
505− -> TableExpression schema params from 'Ungrouped
505+ -> TableExpression db params from 'Ungrouped
506 -- ^ intermediate virtual table
506 -- ^ intermediate virtual table
507 -> Query db params columns
507 -> Query db params columns
508selectDistinctDotStar rel tab = UnsafeQuery $
508selectDistinctDotStar rel tab = UnsafeQuery $
@@ -520,8 +520,8 @@ selectDistinctDotStar rel tab = UnsafeQuery $
520-- SELECT * FROM (VALUES (1, E'one')) AS t ("a", "b")
520-- SELECT * FROM (VALUES (1, E'one')) AS t ("a", "b")
521values
521values
522 :: SListI cols
522 :: SListI cols
523− => NP (Aliased (Expression schema '[] 'Ungrouped params)) cols
523+ => NP (Aliased (Expression db '[] 'Ungrouped params)) cols
524− -> [NP (Aliased (Expression schema '[] 'Ungrouped params)) cols]
524+ -> [NP (Aliased (Expression db '[] 'Ungrouped params)) cols]
525 -- ^ When more than one row is specified, all the rows must
525 -- ^ When more than one row is specified, all the rows must
526 -- must have the same number of elements
526 -- must have the same number of elements
527 -> Query db params cols
527 -> Query db params cols
@@ -535,7 +535,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
535 <+> parenthesized (renderCommaSeparated renderAliasPart rw)
535 <+> parenthesized (renderCommaSeparated renderAliasPart rw)
536 where
536 where
537 renderAliasPart, renderValuePart
537 renderAliasPart, renderValuePart
538− :: Aliased (Expression schema '[] 'Ungrouped params) ty -> ByteString
538+ :: Aliased (Expression db '[] 'Ungrouped params) ty -> ByteString
539 renderAliasPart (_ `As` name) = renderAlias name
539 renderAliasPart (_ `As` name) = renderAlias name
540 renderValuePart (value `As` _) = renderExpression value
540 renderValuePart (value `As` _) = renderExpression value
541
541
@@ -543,7 +543,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
543-- specified by value expressions.
543-- specified by value expressions.
544values_
544values_
545 :: SListI cols
545 :: SListI cols
546− => NP (Aliased (Expression schema '[] 'Ungrouped params)) cols
546+ => NP (Aliased (Expression db '[] 'Ungrouped params)) cols
547 -- ^ one row of values
547 -- ^ one row of values
548 -> Query db params cols
548 -> Query db params cols
549values_ rw = values rw []
549values_ rw = values rw []
@@ -607,7 +607,7 @@ data TableExpression
607
607
608-- | Render a `TableExpression`
608-- | Render a `TableExpression`
609renderTableExpression
609renderTableExpression
610− :: TableExpression schema params from grouping
610+ :: TableExpression db params from grouping
611 -> ByteString
611 -> ByteString
612renderTableExpression
612renderTableExpression
613 (TableExpression frm' whs' grps' hvs' srts' lims' offs') = mconcat
613 (TableExpression frm' whs' grps' hvs' srts' lims' offs') = mconcat
@@ -641,16 +641,16 @@ renderTableExpression
641-- `group`, `having`, `orderBy`, `limit` and `offset`, using the `&` operator
641-- `group`, `having`, `orderBy`, `limit` and `offset`, using the `&` operator
642-- to match the left-to-right sequencing of their placement in SQL.
642-- to match the left-to-right sequencing of their placement in SQL.
643from
643from
644− :: FromClause schema params from -- ^ table reference
644+ :: FromClause db params from -- ^ table reference
645− -> TableExpression schema params from 'Ungrouped
645+ -> TableExpression db params from 'Ungrouped
646from rels = TableExpression rels [] NoGroups NoHaving [] [] []
646from rels = TableExpression rels [] NoGroups NoHaving [] [] []
647
647
648-- | A `where_` is an endomorphism of `TableExpression`s which adds a
648-- | A `where_` is an endomorphism of `TableExpression`s which adds a
649-- search condition to the `whereClause`.
649-- search condition to the `whereClause`.
650where_
650where_
651− :: Condition schema from 'Ungrouped params -- ^ filtering condition
651+ :: Condition db from 'Ungrouped params -- ^ filtering condition
652− -> TableExpression schema params from grouping
652+ -> TableExpression db params from grouping
653− -> TableExpression schema params from grouping
653+ -> TableExpression db params from grouping
654where_ wh rels = rels {whereClause = wh : whereClause rels}
654where_ wh rels = rels {whereClause = wh : whereClause rels}
655
655
656-- | A `groupBy` is a transformation of `TableExpression`s which switches
656-- | A `groupBy` is a transformation of `TableExpression`s which switches
@@ -659,8 +659,8 @@ where_ wh rels = rels {whereClause = wh : whereClause rels}
659groupBy
659groupBy
660 :: SListI bys
660 :: SListI bys
661 => NP (By from) bys -- ^ grouped columns
661 => NP (By from) bys -- ^ grouped columns
662− -> TableExpression schema params from 'Ungrouped
662+ -> TableExpression db params from 'Ungrouped
663− -> TableExpression schema params from ('Grouped bys)
663+ -> TableExpression db params from ('Grouped bys)
664groupBy bys rels = TableExpression
664groupBy bys rels = TableExpression
665 { fromClause = fromClause rels
665 { fromClause = fromClause rels
666 , whereClause = whereClause rels
666 , whereClause = whereClause rels
@@ -674,34 +674,34 @@ groupBy bys rels = TableExpression
674-- | A `having` is an endomorphism of `TableExpression`s which adds a
674-- | A `having` is an endomorphism of `TableExpression`s which adds a
675-- search condition to the `havingClause`.
675-- search condition to the `havingClause`.
676having
676having
677− :: Condition schema from ('Grouped bys) params -- ^ having condition
677+ :: Condition db from ('Grouped bys) params -- ^ having condition
678− -> TableExpression schema params from ('Grouped bys)
678+ -> TableExpression db params from ('Grouped bys)
679− -> TableExpression schema params from ('Grouped bys)
679+ -> TableExpression db params from ('Grouped bys)
680having hv rels = rels
680having hv rels = rels
681 { havingClause = case havingClause rels of Having hvs -> Having (hv:hvs) }
681 { havingClause = case havingClause rels of Having hvs -> Having (hv:hvs) }
682
682
683-- | An `orderBy` is an endomorphism of `TableExpression`s which appends an
683-- | An `orderBy` is an endomorphism of `TableExpression`s which appends an
684-- ordering to the right of the `orderByClause`.
684-- ordering to the right of the `orderByClause`.
685orderBy
685orderBy
686− :: [SortExpression schema from grouping params] -- ^ sort expressions
686+ :: [SortExpression db from grouping params] -- ^ sort expressions
687− -> TableExpression schema params from grouping
687+ -> TableExpression db params from grouping
688− -> TableExpression schema params from grouping
688+ -> TableExpression db params from grouping
689orderBy srts rels = rels {orderByClause = orderByClause rels ++ srts}
689orderBy srts rels = rels {orderByClause = orderByClause rels ++ srts}
690
690
691-- | A `limit` is an endomorphism of `TableExpression`s which adds to the
691-- | A `limit` is an endomorphism of `TableExpression`s which adds to the
692-- `limitClause`.
692-- `limitClause`.
693limit
693limit
694 :: Word64 -- ^ limit parameter
694 :: Word64 -- ^ limit parameter
695− -> TableExpression schema params from grouping
695+ -> TableExpression db params from grouping
696− -> TableExpression schema params from grouping
696+ -> TableExpression db params from grouping
697limit lim rels = rels {limitClause = lim : limitClause rels}
697limit lim rels = rels {limitClause = lim : limitClause rels}
698
698
699-- | An `offset` is an endomorphism of `TableExpression`s which adds to the
699-- | An `offset` is an endomorphism of `TableExpression`s which adds to the
700-- `offsetClause`.
700-- `offsetClause`.
701offset
701offset
702 :: Word64 -- ^ offset parameter
702 :: Word64 -- ^ offset parameter
703− -> TableExpression schema params from grouping
703+ -> TableExpression db params from grouping
704− -> TableExpression schema params from grouping
704+ -> TableExpression db params from grouping
705offset off rels = rels {offsetClause = off : offsetClause rels}
705offset off rels = rels {offsetClause = off : offsetClause rels}
706
706
707{-----------------------------------------
707{-----------------------------------------
@@ -710,55 +710,55 @@ JSON stuff
710
710
711unsafeSetOfFunction
711unsafeSetOfFunction
712 :: ByteString
712 :: ByteString
713− -> Expression schema '[] 'Ungrouped params ty
713+ -> Expression db '[] 'Ungrouped params ty
714 -> Query db params row
714 -> Query db params row
715unsafeSetOfFunction fun expr = UnsafeQuery $
715unsafeSetOfFunction fun expr = UnsafeQuery $
716 "SELECT * FROM " <> fun <> "(" <> renderExpression expr <> ")"
716 "SELECT * FROM " <> fun <> "(" <> renderExpression expr <> ")"
717
717
718-- | Expands the outermost JSON object into a set of key/value pairs.
718-- | Expands the outermost JSON object into a set of key/value pairs.
719jsonEach
719jsonEach
720− :: Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
720+ :: Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
721 -> Query db params
721 -> Query db params
722 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson]
722 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson]
723jsonEach = unsafeSetOfFunction "json_each"
723jsonEach = unsafeSetOfFunction "json_each"
724
724
725-- | Expands the outermost binary JSON object into a set of key/value pairs.
725-- | Expands the outermost binary JSON object into a set of key/value pairs.
726jsonbEach
726jsonbEach
727− :: Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
727+ :: Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
728 -> Query db params
728 -> Query db params
729 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjsonb]
729 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjsonb]
730jsonbEach = unsafeSetOfFunction "jsonb_each"
730jsonbEach = unsafeSetOfFunction "jsonb_each"
731
731
732-- | Expands the outermost JSON object into a set of key/value pairs.
732-- | Expands the outermost JSON object into a set of key/value pairs.
733jsonEachAsText
733jsonEachAsText
734− :: Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
734+ :: Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
735 -> Query db params
735 -> Query db params
736 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
736 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
737jsonEachAsText = unsafeSetOfFunction "json_each_text"
737jsonEachAsText = unsafeSetOfFunction "json_each_text"
738
738
739-- | Expands the outermost binary JSON object into a set of key/value pairs.
739-- | Expands the outermost binary JSON object into a set of key/value pairs.
740jsonbEachAsText
740jsonbEachAsText
741− :: Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
741+ :: Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
742 -> Query db params
742 -> Query db params
743 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
743 '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]
744jsonbEachAsText = unsafeSetOfFunction "jsonb_each_text"
744jsonbEachAsText = unsafeSetOfFunction "jsonb_each_text"
745
745
746-- | Returns set of keys in the outermost JSON object.
746-- | Returns set of keys in the outermost JSON object.
747jsonObjectKeys
747jsonObjectKeys
748− :: Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
748+ :: Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
749 -> Query db params '["json_object_keys" ::: 'NotNull 'PGtext]
749 -> Query db params '["json_object_keys" ::: 'NotNull 'PGtext]
750jsonObjectKeys = unsafeSetOfFunction "json_object_keys"
750jsonObjectKeys = unsafeSetOfFunction "json_object_keys"
751
751
752-- | Returns set of keys in the outermost JSON object.
752-- | Returns set of keys in the outermost JSON object.
753jsonbObjectKeys
753jsonbObjectKeys
754− :: Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
754+ :: Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
755 -> Query db params '["jsonb_object_keys" ::: 'NotNull 'PGtext]
755 -> Query db params '["jsonb_object_keys" ::: 'NotNull 'PGtext]
756jsonbObjectKeys = unsafeSetOfFunction "jsonb_object_keys"
756jsonbObjectKeys = unsafeSetOfFunction "jsonb_object_keys"
757
757
758unsafePopulateFunction
758unsafePopulateFunction
759 :: ByteString
759 :: ByteString
760− -> TypeExpression schema (nullity ('PGcomposite row))
760+ -> TypeExpression db (nullity ('PGcomposite row))
761− -> Expression schema '[] 'Ungrouped params ty
761+ -> Expression db '[] 'Ungrouped params ty
762 -> Query db params row
762 -> Query db params row
763unsafePopulateFunction fun ty expr = UnsafeQuery $
763unsafePopulateFunction fun ty expr = UnsafeQuery $
764 "SELECT * FROM " <> fun <> "("
764 "SELECT * FROM " <> fun <> "("
@@ -768,24 +768,24 @@ unsafePopulateFunction fun ty expr = UnsafeQuery $
768-- | Expands the JSON expression to a row whose columns match the record
768-- | Expands the JSON expression to a row whose columns match the record
769-- type defined by the given table.
769-- type defined by the given table.
770jsonPopulateRecord
770jsonPopulateRecord
771− :: TypeExpression schema (nullity ('PGcomposite row)) -- ^ row type
771+ :: TypeExpression db (nullity ('PGcomposite row)) -- ^ row type
772− -> Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
772+ -> Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
773 -> Query db params row
773 -> Query db params row
774jsonPopulateRecord = unsafePopulateFunction "json_populate_record"
774jsonPopulateRecord = unsafePopulateFunction "json_populate_record"
775
775
776-- | Expands the binary JSON expression to a row whose columns match the record
776-- | Expands the binary JSON expression to a row whose columns match the record
777-- type defined by the given table.
777-- type defined by the given table.
778jsonbPopulateRecord
778jsonbPopulateRecord
779− :: TypeExpression schema (nullity ('PGcomposite row)) -- ^ row type
779+ :: TypeExpression db (nullity ('PGcomposite row)) -- ^ row type
780− -> Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
780+ -> Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
781 -> Query db params row
781 -> Query db params row
782jsonbPopulateRecord = unsafePopulateFunction "jsonb_populate_record"
782jsonbPopulateRecord = unsafePopulateFunction "jsonb_populate_record"
783
783
784-- | Expands the outermost array of objects in the given JSON expression to a
784-- | Expands the outermost array of objects in the given JSON expression to a
785-- set of rows whose columns match the record type defined by the given table.
785-- set of rows whose columns match the record type defined by the given table.
786jsonPopulateRecordSet
786jsonPopulateRecordSet
787− :: TypeExpression schema (nullity ('PGcomposite row)) -- ^ row type
787+ :: TypeExpression db (nullity ('PGcomposite row)) -- ^ row type
788− -> Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json array
788+ -> Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json array
789 -> Query db params row
789 -> Query db params row
790jsonPopulateRecordSet = unsafePopulateFunction "json_populate_record_set"
790jsonPopulateRecordSet = unsafePopulateFunction "json_populate_record_set"
791
791
@@ -793,55 +793,55 @@ jsonPopulateRecordSet = unsafePopulateFunction "json_populate_record_set"
793-- to a set of rows whose columns match the record type defined by the given
793-- to a set of rows whose columns match the record type defined by the given
794-- table.
794-- table.
795jsonbPopulateRecordSet
795jsonbPopulateRecordSet
796− :: TypeExpression schema (nullity ('PGcomposite row)) -- ^ row type
796+ :: TypeExpression db (nullity ('PGcomposite row)) -- ^ row type
797− -> Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb array
797+ -> Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb array
798 -> Query db params row
798 -> Query db params row
799jsonbPopulateRecordSet = unsafePopulateFunction "jsonb_populate_record_set"
799jsonbPopulateRecordSet = unsafePopulateFunction "jsonb_populate_record_set"
800
800
801unsafeRecordFunction
801unsafeRecordFunction
802 :: (SListI record, json `In` PGJsonType)
802 :: (SListI record, json `In` PGJsonType)
803 => ByteString
803 => ByteString
804− -> Expression schema '[] 'Ungrouped params (nullity json)
804+ -> Expression db '[] 'Ungrouped params (nullity json)
805− -> NP (Aliased (TypeExpression schema)) record
805+ -> NP (Aliased (TypeExpression db)) record
806 -> Query db params record
806 -> Query db params record
807unsafeRecordFunction fun expr types = UnsafeQuery $
807unsafeRecordFunction fun expr types = UnsafeQuery $
808 "SELECT * FROM " <> fun <> "("
808 "SELECT * FROM " <> fun <> "("
809 <> renderExpression expr <> ")"
809 <> renderExpression expr <> ")"
810 <+> "AS" <+> "x" <> parenthesized (renderCommaSeparated renderTy types)
810 <+> "AS" <+> "x" <> parenthesized (renderCommaSeparated renderTy types)
811 where
811 where
812− renderTy :: Aliased (TypeExpression schema) ty -> ByteString
812+ renderTy :: Aliased (TypeExpression db) ty -> ByteString
813 renderTy (ty `As` alias) =
813 renderTy (ty `As` alias) =
814 renderAlias alias <+> renderTypeExpression ty
814 renderAlias alias <+> renderTypeExpression ty
815
815
816-- | Builds an arbitrary record from a JSON object.
816-- | Builds an arbitrary record from a JSON object.
817jsonToRecord
817jsonToRecord
818 :: SListI record
818 :: SListI record
819− => Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
819+ => Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json object
820− -> NP (Aliased (TypeExpression schema)) record -- ^ record types
820+ -> NP (Aliased (TypeExpression db)) record -- ^ record types
821 -> Query db params record
821 -> Query db params record
822jsonToRecord = unsafeRecordFunction "json_to_record"
822jsonToRecord = unsafeRecordFunction "json_to_record"
823
823
824-- | Builds an arbitrary record from a binary JSON object.
824-- | Builds an arbitrary record from a binary JSON object.
825jsonbToRecord
825jsonbToRecord
826 :: SListI record
826 :: SListI record
827− => Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
827+ => Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb object
828− -> NP (Aliased (TypeExpression schema)) record -- ^ record types
828+ -> NP (Aliased (TypeExpression db)) record -- ^ record types
829 -> Query db params record
829 -> Query db params record
830jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
830jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
831
831
832-- | Builds an arbitrary set of records from a JSON array of objects.
832-- | Builds an arbitrary set of records from a JSON array of objects.
833jsonToRecordSet
833jsonToRecordSet
834 :: SListI record
834 :: SListI record
835− => Expression schema '[] 'Ungrouped params (nullity 'PGjson) -- ^ json array
835+ => Expression db '[] 'Ungrouped params (nullity 'PGjson) -- ^ json array
836− -> NP (Aliased (TypeExpression schema)) record -- ^ record types
836+ -> NP (Aliased (TypeExpression db)) record -- ^ record types
837 -> Query db params record
837 -> Query db params record
838jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
838jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
839
839
840-- | Builds an arbitrary set of records from a binary JSON array of objects.
840-- | Builds an arbitrary set of records from a binary JSON array of objects.
841jsonbToRecordSet
841jsonbToRecordSet
842 :: SListI record
842 :: SListI record
843− => Expression schema '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb array
843+ => Expression db '[] 'Ungrouped params (nullity 'PGjsonb) -- ^ jsonb array
844− -> NP (Aliased (TypeExpression schema)) record -- ^ record types
844+ -> NP (Aliased (TypeExpression db)) record -- ^ record types
845 -> Query db params record
845 -> Query db params record
846jsonbToRecordSet = unsafeRecordFunction "jsonb_to_record_set"
846jsonbToRecordSet = unsafeRecordFunction "jsonb_to_record_set"
847
847
@@ -857,7 +857,7 @@ newtype FromClause db params from
857 = UnsafeFromClause { renderFromClause :: ByteString }
857 = UnsafeFromClause { renderFromClause :: ByteString }
858 deriving (GHC.Generic,Show,Eq,Ord,NFData)
858 deriving (GHC.Generic,Show,Eq,Ord,NFData)
859
859
860−-- | A real `table` is a table from the schema.
860+-- | A real `table` is a table from the database.
861table
861table
862 :: (Has sch db schema, Has tab schema ('Table table))
862 :: (Has sch db schema, Has tab schema ('Table table))
863 => Aliased (QualifiedAlias sch) (alias ::: tab)
863 => Aliased (QualifiedAlias sch) (alias ::: tab)
@@ -868,7 +868,7 @@ table (tab `As` alias) = UnsafeFromClause $
868-- | `subquery` derives a table from a `Query`.
868-- | `subquery` derives a table from a `Query`.
869subquery
869subquery
870 :: Aliased (Query db params) query
870 :: Aliased (Query db params) query
871− -> FromClause schema params '[query]
871+ -> FromClause db params '[query]
872subquery = UnsafeFromClause . renderAliasedAs (parenthesized . renderQuery)
872subquery = UnsafeFromClause . renderAliasedAs (parenthesized . renderQuery)
873
873
874-- | `view` derives a table from a `View`.
874-- | `view` derives a table from a `View`.
@@ -886,11 +886,11 @@ view (vw `As` alias) = UnsafeFromClause $
886 have @n * m@ rows.
886 have @n * m@ rows.
887-}
887-}
888crossJoin
888crossJoin
889− :: FromClause schema params right
889+ :: FromClause db params right
890 -- ^ right
890 -- ^ right
891− -> FromClause schema params left
891+ -> FromClause db params left
892 -- ^ left
892 -- ^ left
893− -> FromClause schema params (Join left right)
893+ -> FromClause db params (Join left right)
894crossJoin right left = UnsafeFromClause $
894crossJoin right left = UnsafeFromClause $
895 renderFromClause left <+> "CROSS JOIN" <+> renderFromClause right
895 renderFromClause left <+> "CROSS JOIN" <+> renderFromClause right
896
896
@@ -898,13 +898,13 @@ crossJoin right left = UnsafeFromClause $
898the @on@ condition.
898the @on@ condition.
899-}
899-}
900innerJoin
900innerJoin
901− :: FromClause schema params right
901+ :: FromClause db params right
902 -- ^ right
902 -- ^ right
903− -> Condition schema (Join left right) 'Ungrouped params
903+ -> Condition db (Join left right) 'Ungrouped params
904 -- ^ @on@ condition
904 -- ^ @on@ condition
905− -> FromClause schema params left
905+ -> FromClause db params left
906 -- ^ left
906 -- ^ left
907− -> FromClause schema params (Join left right)
907+ -> FromClause db params (Join left right)
908innerJoin right on left = UnsafeFromClause $
908innerJoin right on left = UnsafeFromClause $
909 renderFromClause left <+> "INNER JOIN" <+> renderFromClause right
909 renderFromClause left <+> "INNER JOIN" <+> renderFromClause right
910 <+> "ON" <+> renderExpression on
910 <+> "ON" <+> renderExpression on
@@ -915,13 +915,13 @@ innerJoin right on left = UnsafeFromClause $
915 Thus, the joined table always has at least one row for each row in @left@.
915 Thus, the joined table always has at least one row for each row in @left@.
916-}
916-}
917leftOuterJoin
917leftOuterJoin
918− :: FromClause schema params right
918+ :: FromClause db params right
919 -- ^ right
919 -- ^ right
920− -> Condition schema (Join left right) 'Ungrouped params
920+ -> Condition db (Join left right) 'Ungrouped params
921 -- ^ @on@ condition
921 -- ^ @on@ condition
922− -> FromClause schema params left
922+ -> FromClause db params left
923 -- ^ left
923 -- ^ left
924− -> FromClause schema params (Join left (NullifyFrom right))
924+ -> FromClause db params (Join left (NullifyFrom right))
925leftOuterJoin right on left = UnsafeFromClause $
925leftOuterJoin right on left = UnsafeFromClause $
926 renderFromClause left <+> "LEFT OUTER JOIN" <+> renderFromClause right
926 renderFromClause left <+> "LEFT OUTER JOIN" <+> renderFromClause right
927 <+> "ON" <+> renderExpression on
927 <+> "ON" <+> renderExpression on
@@ -933,13 +933,13 @@ leftOuterJoin right on left = UnsafeFromClause $
933 have a row for each row in @right@.
933 have a row for each row in @right@.
934-}
934-}
935rightOuterJoin
935rightOuterJoin
936− :: FromClause schema params right
936+ :: FromClause db params right
937 -- ^ right
937 -- ^ right
938− -> Condition schema (Join left right) 'Ungrouped params
938+ -> Condition db (Join left right) 'Ungrouped params
939 -- ^ @on@ condition
939 -- ^ @on@ condition
940− -> FromClause schema params left
940+ -> FromClause db params left
941 -- ^ left
941 -- ^ left
942− -> FromClause schema params (Join (NullifyFrom left) right)
942+ -> FromClause db params (Join (NullifyFrom left) right)
943rightOuterJoin right on left = UnsafeFromClause $
943rightOuterJoin right on left = UnsafeFromClause $
944 renderFromClause left <+> "RIGHT OUTER JOIN" <+> renderFromClause right
944 renderFromClause left <+> "RIGHT OUTER JOIN" <+> renderFromClause right
945 <+> "ON" <+> renderExpression on
945 <+> "ON" <+> renderExpression on
@@ -952,13 +952,13 @@ rightOuterJoin right on left = UnsafeFromClause $
952 is added.
952 is added.
953-}
953-}
954fullOuterJoin
954fullOuterJoin
955− :: FromClause schema params right
955+ :: FromClause db params right
956 -- ^ right
956 -- ^ right
957− -> Condition schema (Join left right) 'Ungrouped params
957+ -> Condition db (Join left right) 'Ungrouped params
958 -- ^ @on@ condition
958 -- ^ @on@ condition
959− -> FromClause schema params left
959+ -> FromClause db params left
960 -- ^ left
960 -- ^ left
961− -> FromClause schema params
961+ -> FromClause db params
962 (Join (NullifyFrom left) (NullifyFrom right))
962 (Join (NullifyFrom left) (NullifyFrom right))
963fullOuterJoin right on left = UnsafeFromClause $
963fullOuterJoin right on left = UnsafeFromClause $
964 renderFromClause left <+> "FULL OUTER JOIN" <+> renderFromClause right
964 renderFromClause left <+> "FULL OUTER JOIN" <+> renderFromClause right
@@ -1029,17 +1029,17 @@ renderGroupByClause = \case
1029-- An `Ungrouped` `TableExpression` may only use `NoHaving` while a `Grouped`
1029-- An `Ungrouped` `TableExpression` may only use `NoHaving` while a `Grouped`
1030-- `TableExpression` must use `Having` whose conditions are combined with
1030-- `TableExpression` must use `Having` whose conditions are combined with
1031-- `.&&`.
1031-- `.&&`.
1032−data HavingClause schema from grouping params where
1032+data HavingClause db from grouping params where
1033− NoHaving :: HavingClause schema from 'Ungrouped params
1033+ NoHaving :: HavingClause db from 'Ungrouped params
1034 Having
1034 Having
1035− :: [Condition schema from ('Grouped bys) params]
1035+ :: [Condition db from ('Grouped bys) params]
1036− -> HavingClause schema from ('Grouped bys) params
1036+ -> HavingClause db from ('Grouped bys) params
1037−deriving instance Show (HavingClause schema from grouping params)
1037+deriving instance Show (HavingClause db from grouping params)
1038−deriving instance Eq (HavingClause schema from grouping params)
1038+deriving instance Eq (HavingClause db from grouping params)
1039−deriving instance Ord (HavingClause schema from grouping params)
1039+deriving instance Ord (HavingClause db from grouping params)
1040
1040
1041-- | Render a `HavingClause`.
1041-- | Render a `HavingClause`.
1042−renderHavingClause :: HavingClause schema from grouping params -> ByteString
1042+renderHavingClause :: HavingClause db from grouping params -> ByteString
1043renderHavingClause = \case
1043renderHavingClause = \case
1044 NoHaving -> ""
1044 NoHaving -> ""
1045 Having [] -> ""
1045 Having [] -> ""
@@ -1058,29 +1058,29 @@ Sorting
1058-- `AscNullsLast`, `DescNullsFirst` and `DescNullsLast` options are used to
1058-- `AscNullsLast`, `DescNullsFirst` and `DescNullsLast` options are used to
1059-- determine whether nulls appear before or after non-null values in the sort
1059-- determine whether nulls appear before or after non-null values in the sort
1060-- ordering of a `Null` result column.
1060-- ordering of a `Null` result column.
1061−data SortExpression schema from grouping params where
1061+data SortExpression db from grouping params where
1062 Asc
1062 Asc
1063− :: Expression schema from grouping params ('NotNull ty)
1063+ :: Expression db from grouping params ('NotNull ty)
1064− -> SortExpression schema from grouping params
1064+ -> SortExpression db from grouping params
1065 Desc
1065 Desc
1066− :: Expression schema from grouping params ('NotNull ty)
1066+ :: Expression db from grouping params ('NotNull ty)
1067− -> SortExpression schema from grouping params
1067+ -> SortExpression db from grouping params
1068 AscNullsFirst
1068 AscNullsFirst
1069− :: Expression schema from grouping params ('Null ty)
1069+ :: Expression db from grouping params ('Null ty)
1070− -> SortExpression schema from grouping params
1070+ -> SortExpression db from grouping params
1071 AscNullsLast
1071 AscNullsLast
1072− :: Expression schema from grouping params ('Null ty)
1072+ :: Expression db from grouping params ('Null ty)
1073− -> SortExpression schema from grouping params
1073+ -> SortExpression db from grouping params
1074 DescNullsFirst
1074 DescNullsFirst
1075− :: Expression schema from grouping params ('Null ty)
1075+ :: Expression db from grouping params ('Null ty)
1076− -> SortExpression schema from grouping params
1076+ -> SortExpression db from grouping params
1077 DescNullsLast
1077 DescNullsLast
1078− :: Expression schema from grouping params ('Null ty)
1078+ :: Expression db from grouping params ('Null ty)
1079− -> SortExpression schema from grouping params
1079+ -> SortExpression db from grouping params
1080−deriving instance Show (SortExpression schema from grouping params)
1080+deriving instance Show (SortExpression db from grouping params)
1081
1081
1082-- | Render a `SortExpression`.
1082-- | Render a `SortExpression`.
1083−renderSortExpression :: SortExpression schema from grouping params -> ByteString
1083+renderSortExpression :: SortExpression db from grouping params -> ByteString
1084renderSortExpression = \case
1084renderSortExpression = \case
1085 Asc expression -> renderExpression expression <+> "ASC"
1085 Asc expression -> renderExpression expression <+> "ASC"
1086 Desc expression -> renderExpression expression <+> "DESC"
1086 Desc expression -> renderExpression expression <+> "DESC"
@@ -1093,18 +1093,18 @@ renderSortExpression = \case
1093
1093
1094unsafeSubqueryExpression
1094unsafeSubqueryExpression
1095 :: ByteString
1095 :: ByteString
1096− -> Expression schema from grp params ty
1096+ -> Expression db from grp params ty
1097 -> Query db params '[alias ::: ty]
1097 -> Query db params '[alias ::: ty]
1098− -> Expression schema from grp params (nullity 'PGbool)
1098+ -> Expression db from grp params (nullity 'PGbool)
1099unsafeSubqueryExpression op x q = UnsafeExpression $
1099unsafeSubqueryExpression op x q = UnsafeExpression $
1100 renderExpression x <+> op <+> parenthesized (renderQuery q)
1100 renderExpression x <+> op <+> parenthesized (renderQuery q)
1101
1101
1102unsafeRowSubqueryExpression
1102unsafeRowSubqueryExpression
1103 :: SListI row
1103 :: SListI row
1104 => ByteString
1104 => ByteString
1105− -> NP (Aliased (Expression schema from grp params)) row
1105+ -> NP (Aliased (Expression db from grp params)) row
1106 -> Query db params row
1106 -> Query db params row
1107− -> Expression schema from grp params (nullity 'PGbool)
1107+ -> Expression db from grp params (nullity 'PGbool)
1108unsafeRowSubqueryExpression op xs q = UnsafeExpression $
1108unsafeRowSubqueryExpression op xs q = UnsafeExpression $
1109 renderExpression (row xs) <+> op <+> parenthesized (renderQuery q)
1109 renderExpression (row xs) <+> op <+> parenthesized (renderQuery q)
1110
1110
@@ -1117,9 +1117,9 @@ unsafeRowSubqueryExpression op xs q = UnsafeExpression $
1117-- >>> printSQL $ true `in_` values_ (true `as` #foo)
1117-- >>> printSQL $ true `in_` values_ (true `as` #foo)
1118-- TRUE IN (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1118-- TRUE IN (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1119in_
1119in_
1120− :: Expression schema from grp params ty -- ^ expression
1120+ :: Expression db from grp params ty -- ^ expression
1121 -> Query db params '[alias ::: ty] -- ^ subquery
1121 -> Query db params '[alias ::: ty] -- ^ subquery
1122− -> Expression schema from grp params (nullity 'PGbool)
1122+ -> Expression db from grp params (nullity 'PGbool)
1123in_ = unsafeSubqueryExpression "IN"
1123in_ = unsafeSubqueryExpression "IN"
1124
1124
1125{- | The left-hand side of this form of `rowIn` is a row constructor.
1125{- | The left-hand side of this form of `rowIn` is a row constructor.
@@ -1138,17 +1138,17 @@ ROW(1, FALSE) IN (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1138-}
1138-}
1139rowIn
1139rowIn
1140 :: SListI row
1140 :: SListI row
1141− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1141+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1142 -> Query db params row -- ^ subquery
1142 -> Query db params row -- ^ subquery
1143− -> Expression schema from grp params (nullity 'PGbool)
1143+ -> Expression db from grp params (nullity 'PGbool)
1144rowIn = unsafeRowSubqueryExpression "IN"
1144rowIn = unsafeRowSubqueryExpression "IN"
1145
1145
1146-- | >>> printSQL $ true `eqAll` values_ (true `as` #foo)
1146-- | >>> printSQL $ true `eqAll` values_ (true `as` #foo)
1147-- TRUE = ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1147-- TRUE = ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1148eqAll
1148eqAll
1149− :: Expression schema from grp params ty -- ^ expression
1149+ :: Expression db from grp params ty -- ^ expression
1150 -> Query db params '[alias ::: ty] -- ^ subquery
1150 -> Query db params '[alias ::: ty] -- ^ subquery
1151− -> Expression schema from grp params (nullity 'PGbool)
1151+ -> Expression db from grp params (nullity 'PGbool)
1152eqAll = unsafeSubqueryExpression "= ALL"
1152eqAll = unsafeSubqueryExpression "= ALL"
1153
1153
1154-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1154-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1156,17 +1156,17 @@ eqAll = unsafeSubqueryExpression "= ALL"
1156-- ROW(1, FALSE) = ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1156-- ROW(1, FALSE) = ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1157rowEqAll
1157rowEqAll
1158 :: SListI row
1158 :: SListI row
1159− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1159+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1160 -> Query db params row -- ^ subquery
1160 -> Query db params row -- ^ subquery
1161− -> Expression schema from grp params (nullity 'PGbool)
1161+ -> Expression db from grp params (nullity 'PGbool)
1162rowEqAll = unsafeRowSubqueryExpression "= ALL"
1162rowEqAll = unsafeRowSubqueryExpression "= ALL"
1163
1163
1164-- | >>> printSQL $ true `eqAny` values_ (true `as` #foo)
1164-- | >>> printSQL $ true `eqAny` values_ (true `as` #foo)
1165-- TRUE = ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1165-- TRUE = ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1166eqAny
1166eqAny
1167− :: Expression schema from grp params ty -- ^ expression
1167+ :: Expression db from grp params ty -- ^ expression
1168 -> Query db params '[alias ::: ty] -- ^ subquery
1168 -> Query db params '[alias ::: ty] -- ^ subquery
1169− -> Expression schema from grp params (nullity 'PGbool)
1169+ -> Expression db from grp params (nullity 'PGbool)
1170eqAny = unsafeSubqueryExpression "= ANY"
1170eqAny = unsafeSubqueryExpression "= ANY"
1171
1171
1172-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1172-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1174,17 +1174,17 @@ eqAny = unsafeSubqueryExpression "= ANY"
1174-- ROW(1, FALSE) = ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1174-- ROW(1, FALSE) = ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1175rowEqAny
1175rowEqAny
1176 :: SListI row
1176 :: SListI row
1177− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1177+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1178 -> Query db params row -- ^ subquery
1178 -> Query db params row -- ^ subquery
1179− -> Expression schema from grp params (nullity 'PGbool)
1179+ -> Expression db from grp params (nullity 'PGbool)
1180rowEqAny = unsafeRowSubqueryExpression "= ANY"
1180rowEqAny = unsafeRowSubqueryExpression "= ANY"
1181
1181
1182-- | >>> printSQL $ true `neqAll` values_ (true `as` #foo)
1182-- | >>> printSQL $ true `neqAll` values_ (true `as` #foo)
1183-- TRUE <> ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1183-- TRUE <> ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1184neqAll
1184neqAll
1185− :: Expression schema from grp params ty -- ^ expression
1185+ :: Expression db from grp params ty -- ^ expression
1186 -> Query db params '[alias ::: ty] -- ^ subquery
1186 -> Query db params '[alias ::: ty] -- ^ subquery
1187− -> Expression schema from grp params (nullity 'PGbool)
1187+ -> Expression db from grp params (nullity 'PGbool)
1188neqAll = unsafeSubqueryExpression "<> ALL"
1188neqAll = unsafeSubqueryExpression "<> ALL"
1189
1189
1190-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1190-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1192,17 +1192,17 @@ neqAll = unsafeSubqueryExpression "<> ALL"
1192-- ROW(1, FALSE) <> ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1192-- ROW(1, FALSE) <> ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1193rowNeqAll
1193rowNeqAll
1194 :: SListI row
1194 :: SListI row
1195− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1195+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1196 -> Query db params row -- ^ subquery
1196 -> Query db params row -- ^ subquery
1197− -> Expression schema from grp params (nullity 'PGbool)
1197+ -> Expression db from grp params (nullity 'PGbool)
1198rowNeqAll = unsafeRowSubqueryExpression "<> ALL"
1198rowNeqAll = unsafeRowSubqueryExpression "<> ALL"
1199
1199
1200-- | >>> printSQL $ true `neqAny` values_ (true `as` #foo)
1200-- | >>> printSQL $ true `neqAny` values_ (true `as` #foo)
1201-- TRUE <> ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1201-- TRUE <> ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1202neqAny
1202neqAny
1203− :: Expression schema from grp params ty -- ^ expression
1203+ :: Expression db from grp params ty -- ^ expression
1204 -> Query db params '[alias ::: ty] -- ^ subquery
1204 -> Query db params '[alias ::: ty] -- ^ subquery
1205− -> Expression schema from grp params (nullity 'PGbool)
1205+ -> Expression db from grp params (nullity 'PGbool)
1206neqAny = unsafeSubqueryExpression "<> ANY"
1206neqAny = unsafeSubqueryExpression "<> ANY"
1207
1207
1208-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1208-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1210,17 +1210,17 @@ neqAny = unsafeSubqueryExpression "<> ANY"
1210-- ROW(1, FALSE) <> ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1210-- ROW(1, FALSE) <> ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1211rowNeqAny
1211rowNeqAny
1212 :: SListI row
1212 :: SListI row
1213− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1213+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1214 -> Query db params row -- ^ subquery
1214 -> Query db params row -- ^ subquery
1215− -> Expression schema from grp params (nullity 'PGbool)
1215+ -> Expression db from grp params (nullity 'PGbool)
1216rowNeqAny = unsafeRowSubqueryExpression "<> ANY"
1216rowNeqAny = unsafeRowSubqueryExpression "<> ANY"
1217
1217
1218-- | >>> printSQL $ true `allLt` values_ (true `as` #foo)
1218-- | >>> printSQL $ true `allLt` values_ (true `as` #foo)
1219-- TRUE ALL < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1219-- TRUE ALL < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1220allLt
1220allLt
1221− :: Expression schema from grp params ty -- ^ expression
1221+ :: Expression db from grp params ty -- ^ expression
1222 -> Query db params '[alias ::: ty] -- ^ subquery
1222 -> Query db params '[alias ::: ty] -- ^ subquery
1223− -> Expression schema from grp params (nullity 'PGbool)
1223+ -> Expression db from grp params (nullity 'PGbool)
1224allLt = unsafeSubqueryExpression "ALL <"
1224allLt = unsafeSubqueryExpression "ALL <"
1225
1225
1226-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1226-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1228,17 +1228,17 @@ allLt = unsafeSubqueryExpression "ALL <"
1228-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1228-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1229rowLtAll
1229rowLtAll
1230 :: SListI row
1230 :: SListI row
1231− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1231+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1232 -> Query db params row -- ^ subquery
1232 -> Query db params row -- ^ subquery
1233− -> Expression schema from grp params (nullity 'PGbool)
1233+ -> Expression db from grp params (nullity 'PGbool)
1234rowLtAll = unsafeRowSubqueryExpression "ALL <"
1234rowLtAll = unsafeRowSubqueryExpression "ALL <"
1235
1235
1236-- | >>> printSQL $ true `ltAny` values_ (true `as` #foo)
1236-- | >>> printSQL $ true `ltAny` values_ (true `as` #foo)
1237-- TRUE ANY < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1237-- TRUE ANY < (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1238ltAny
1238ltAny
1239− :: Expression schema from grp params ty -- ^ expression
1239+ :: Expression db from grp params ty -- ^ expression
1240 -> Query db params '[alias ::: ty] -- ^ subquery
1240 -> Query db params '[alias ::: ty] -- ^ subquery
1241− -> Expression schema from grp params (nullity 'PGbool)
1241+ -> Expression db from grp params (nullity 'PGbool)
1242ltAny = unsafeSubqueryExpression "ANY <"
1242ltAny = unsafeSubqueryExpression "ANY <"
1243
1243
1244-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1244-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1246,17 +1246,17 @@ ltAny = unsafeSubqueryExpression "ANY <"
1246-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1246-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1247rowLtAny
1247rowLtAny
1248 :: SListI row
1248 :: SListI row
1249− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1249+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1250 -> Query db params row -- ^ subquery
1250 -> Query db params row -- ^ subquery
1251− -> Expression schema from grp params (nullity 'PGbool)
1251+ -> Expression db from grp params (nullity 'PGbool)
1252rowLtAny = unsafeRowSubqueryExpression "ANY <"
1252rowLtAny = unsafeRowSubqueryExpression "ANY <"
1253
1253
1254-- | >>> printSQL $ true `lteAll` values_ (true `as` #foo)
1254-- | >>> printSQL $ true `lteAll` values_ (true `as` #foo)
1255-- TRUE <= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1255-- TRUE <= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1256lteAll
1256lteAll
1257− :: Expression schema from grp params ty -- ^ expression
1257+ :: Expression db from grp params ty -- ^ expression
1258 -> Query db params '[alias ::: ty] -- ^ subquery
1258 -> Query db params '[alias ::: ty] -- ^ subquery
1259− -> Expression schema from grp params (nullity 'PGbool)
1259+ -> Expression db from grp params (nullity 'PGbool)
1260lteAll = unsafeSubqueryExpression "<= ALL"
1260lteAll = unsafeSubqueryExpression "<= ALL"
1261
1261
1262-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1262-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1264,17 +1264,17 @@ lteAll = unsafeSubqueryExpression "<= ALL"
1264-- ROW(1, FALSE) <= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1264-- ROW(1, FALSE) <= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1265rowLteAll
1265rowLteAll
1266 :: SListI row
1266 :: SListI row
1267− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1267+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1268 -> Query db params row -- ^ subquery
1268 -> Query db params row -- ^ subquery
1269− -> Expression schema from grp params (nullity 'PGbool)
1269+ -> Expression db from grp params (nullity 'PGbool)
1270rowLteAll = unsafeRowSubqueryExpression "<= ALL"
1270rowLteAll = unsafeRowSubqueryExpression "<= ALL"
1271
1271
1272-- | >>> printSQL $ true `lteAny` values_ (true `as` #foo)
1272-- | >>> printSQL $ true `lteAny` values_ (true `as` #foo)
1273-- TRUE <= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1273-- TRUE <= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1274lteAny
1274lteAny
1275− :: Expression schema from grp params ty -- ^ expression
1275+ :: Expression db from grp params ty -- ^ expression
1276 -> Query db params '[alias ::: ty] -- ^ subquery
1276 -> Query db params '[alias ::: ty] -- ^ subquery
1277− -> Expression schema from grp params (nullity 'PGbool)
1277+ -> Expression db from grp params (nullity 'PGbool)
1278lteAny = unsafeSubqueryExpression "<= ANY"
1278lteAny = unsafeSubqueryExpression "<= ANY"
1279
1279
1280-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1280-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1282,17 +1282,17 @@ lteAny = unsafeSubqueryExpression "<= ANY"
1282-- ROW(1, FALSE) <= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1282-- ROW(1, FALSE) <= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1283rowLteAny
1283rowLteAny
1284 :: SListI row
1284 :: SListI row
1285− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1285+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1286 -> Query db params row -- ^ subquery
1286 -> Query db params row -- ^ subquery
1287− -> Expression schema from grp params (nullity 'PGbool)
1287+ -> Expression db from grp params (nullity 'PGbool)
1288rowLteAny = unsafeRowSubqueryExpression "<= ANY"
1288rowLteAny = unsafeRowSubqueryExpression "<= ANY"
1289
1289
1290-- | >>> printSQL $ true `gtAll` values_ (true `as` #foo)
1290-- | >>> printSQL $ true `gtAll` values_ (true `as` #foo)
1291-- TRUE > ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1291-- TRUE > ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1292gtAll
1292gtAll
1293− :: Expression schema from grp params ty -- ^ expression
1293+ :: Expression db from grp params ty -- ^ expression
1294 -> Query db params '[alias ::: ty] -- ^ subquery
1294 -> Query db params '[alias ::: ty] -- ^ subquery
1295− -> Expression schema from grp params (nullity 'PGbool)
1295+ -> Expression db from grp params (nullity 'PGbool)
1296gtAll = unsafeSubqueryExpression "> ALL"
1296gtAll = unsafeSubqueryExpression "> ALL"
1297
1297
1298-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1298-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1300,17 +1300,17 @@ gtAll = unsafeSubqueryExpression "> ALL"
1300-- ROW(1, FALSE) > ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1300-- ROW(1, FALSE) > ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1301rowGtAll
1301rowGtAll
1302 :: SListI row
1302 :: SListI row
1303− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1303+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1304 -> Query db params row -- ^ subquery
1304 -> Query db params row -- ^ subquery
1305− -> Expression schema from grp params (nullity 'PGbool)
1305+ -> Expression db from grp params (nullity 'PGbool)
1306rowGtAll = unsafeRowSubqueryExpression "> ALL"
1306rowGtAll = unsafeRowSubqueryExpression "> ALL"
1307
1307
1308-- | >>> printSQL $ true `gtAny` values_ (true `as` #foo)
1308-- | >>> printSQL $ true `gtAny` values_ (true `as` #foo)
1309-- TRUE > ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1309-- TRUE > ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1310gtAny
1310gtAny
1311− :: Expression schema from grp params ty -- ^ expression
1311+ :: Expression db from grp params ty -- ^ expression
1312 -> Query db params '[alias ::: ty] -- ^ subquery
1312 -> Query db params '[alias ::: ty] -- ^ subquery
1313− -> Expression schema from grp params (nullity 'PGbool)
1313+ -> Expression db from grp params (nullity 'PGbool)
1314gtAny = unsafeSubqueryExpression "> ANY"
1314gtAny = unsafeSubqueryExpression "> ANY"
1315
1315
1316-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1316-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1318,17 +1318,17 @@ gtAny = unsafeSubqueryExpression "> ANY"
1318-- ROW(1, FALSE) > ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1318-- ROW(1, FALSE) > ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1319rowGtAny
1319rowGtAny
1320 :: SListI row
1320 :: SListI row
1321− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1321+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1322 -> Query db params row -- ^ subquery
1322 -> Query db params row -- ^ subquery
1323− -> Expression schema from grp params (nullity 'PGbool)
1323+ -> Expression db from grp params (nullity 'PGbool)
1324rowGtAny = unsafeRowSubqueryExpression "> ANY"
1324rowGtAny = unsafeRowSubqueryExpression "> ANY"
1325
1325
1326-- | >>> printSQL $ true `gteAll` values_ (true `as` #foo)
1326-- | >>> printSQL $ true `gteAll` values_ (true `as` #foo)
1327-- TRUE >= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1327-- TRUE >= ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1328gteAll
1328gteAll
1329− :: Expression schema from grp params ty -- ^ expression
1329+ :: Expression db from grp params ty -- ^ expression
1330 -> Query db params '[alias ::: ty] -- ^ subquery
1330 -> Query db params '[alias ::: ty] -- ^ subquery
1331− -> Expression schema from grp params (nullity 'PGbool)
1331+ -> Expression db from grp params (nullity 'PGbool)
1332gteAll = unsafeSubqueryExpression ">= ALL"
1332gteAll = unsafeSubqueryExpression ">= ALL"
1333
1333
1334-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1334-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1336,17 +1336,17 @@ gteAll = unsafeSubqueryExpression ">= ALL"
1336-- ROW(1, FALSE) >= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1336-- ROW(1, FALSE) >= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1337rowGteAll
1337rowGteAll
1338 :: SListI row
1338 :: SListI row
1339− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1339+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1340 -> Query db params row -- ^ subquery
1340 -> Query db params row -- ^ subquery
1341− -> Expression schema from grp params (nullity 'PGbool)
1341+ -> Expression db from grp params (nullity 'PGbool)
1342rowGteAll = unsafeRowSubqueryExpression ">= ALL"
1342rowGteAll = unsafeRowSubqueryExpression ">= ALL"
1343
1343
1344-- | >>> printSQL $ true `gteAny` values_ (true `as` #foo)
1344-- | >>> printSQL $ true `gteAny` values_ (true `as` #foo)
1345-- TRUE >= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1345-- TRUE >= ANY (SELECT * FROM (VALUES (TRUE)) AS t ("foo"))
1346gteAny
1346gteAny
1347− :: Expression schema from grp params ty -- ^ expression
1347+ :: Expression db from grp params ty -- ^ expression
1348 -> Query db params '[alias ::: ty] -- ^ subquery
1348 -> Query db params '[alias ::: ty] -- ^ subquery
1349− -> Expression schema from grp params (nullity 'PGbool)
1349+ -> Expression db from grp params (nullity 'PGbool)
1350gteAny = unsafeSubqueryExpression ">= ANY"
1350gteAny = unsafeSubqueryExpression ">= ANY"
1351
1351
1352-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1352-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
@@ -1354,9 +1354,9 @@ gteAny = unsafeSubqueryExpression ">= ANY"
1354-- ROW(1, FALSE) >= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1354-- ROW(1, FALSE) >= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
1355rowGteAny
1355rowGteAny
1356 :: SListI row
1356 :: SListI row
1357− => NP (Aliased (Expression schema from grp params)) row -- ^ row constructor
1357+ => NP (Aliased (Expression db from grp params)) row -- ^ row constructor
1358 -> Query db params row -- ^ subquery
1358 -> Query db params row -- ^ subquery
1359− -> Expression schema from grp params (nullity 'PGbool)
1359+ -> Expression db from grp params (nullity 'PGbool)
1360rowGteAny = unsafeRowSubqueryExpression ">= ANY"
1360rowGteAny = unsafeRowSubqueryExpression ">= ANY"
1361
1361
1362-- | A `CommonTableExpression` is an auxiliary statement in a `with` clause.
1362-- | A `CommonTableExpression` is an auxiliary statement in a `with` clause.