@@ -1,16 +1,20 @@
1{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
1{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2{-# LANGUAGE
2{-# LANGUAGE
4 , FlexibleContexts
6 , FlexibleContexts
5 , FlexibleInstances
7 , FlexibleInstances
6 , FunctionalDependencies
8 , FunctionalDependencies
10+ , GeneralizedNewtypeDeriving
8 , LambdaCase
11 , LambdaCase
9 , MagicHash
12 , MagicHash
10 , OverloadedStrings
13 , OverloadedStrings
11 , PolyKinds
14 , PolyKinds
12 , RankNTypes
15 , RankNTypes
13 , ScopedTypeVariables
16 , ScopedTypeVariables
14 , TypeApplications
18 , TypeApplications
15 , TypeFamilies
19 , TypeFamilies
16 , TypeOperators
20 , TypeOperators
@@ -20,10 +24,12 @@
20module Squeal.PostgreSQL.Statement where
24module Squeal.PostgreSQL.Statement where
22import Control.Category
26import Control.Category
27+import Control.DeepSeq
23import Data.ByteString (ByteString)
28import Data.ByteString (ByteString)
29+import Data.Data (Data)
24import Data.Foldable
30import Data.Foldable
25import Data.Maybe
31import Data.Maybe
26−import Data.Monoid
32+import Data.Monoid hiding (All)
27import Data.Ratio
33import Data.Ratio
28import Data.String
34import Data.String
29import Data.Word
35import Data.Word
@@ -33,6 +39,7 @@ import GHC.OverloadedLabels
33import GHC.TypeLits
39import GHC.TypeLits
34import Prelude hiding (RealFrac(..), id, (.))
40import Prelude hiding (RealFrac(..), id, (.))
42+import qualified GHC.Generics as GHC
36import qualified Data.ByteString as ByteString
43import qualified Data.ByteString as ByteString
38import Squeal.PostgreSQL.Schema
45import Squeal.PostgreSQL.Schema
@@ -47,7 +54,7 @@ newtype Expression
47 (grouping :: Grouping)
54 (grouping :: Grouping)
48 (ty :: ColumnType)
55 (ty :: ColumnType)
49 = UnsafeExpression { renderExpression :: ByteString }
56 = UnsafeExpression { renderExpression :: ByteString }
50− deriving (Show,Eq)
57+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
52class (PGTyped (BaseType ty), KnownNat n)
59class (PGTyped (BaseType ty), KnownNat n)
53 => HasParameter (n :: Nat) params ty | n params -> ty where
60 => HasParameter (n :: Nat) params ty | n params -> ty where
@@ -80,6 +87,18 @@ instance (HasTable table tables columns, HasColumn column columns ty)
80 table ! column = UnsafeExpression $
87 table ! column = UnsafeExpression $
81 renderAlias table <> "." <> renderAlias column
88 renderAlias table <> "." <> renderAlias column
91+ (columns :: [(Symbol,ColumnType)])
92+ (columnty :: (Symbol,ColumnType))
95+ :: HasColumn column columns ty
97+ -> Column columns (column ::: ty)
98+deriving instance Show (Column columns columnty)
99+deriving instance Eq (Column columns columnty)
100+deriving instance Ord (Column columns columnty)
83def :: Expression params '[] 'Ungrouped ('Optional (nullity ty))
102def :: Expression params '[] 'Ungrouped ('Optional (nullity ty))
84def = UnsafeExpression "DEFAULT"
103def = UnsafeExpression "DEFAULT"
@@ -418,6 +437,7 @@ data SortExpression params tables grouping where
418 DescNullsLast
437 DescNullsLast
419 :: Expression params tables grouping ('Required ('Null ty))
438 :: Expression params tables grouping ('Required ('Null ty))
420 -> SortExpression params tables grouping
439 -> SortExpression params tables grouping
440+deriving instance Show (SortExpression params tables grouping)
422renderSortExpression :: SortExpression params tables grouping -> ByteString
442renderSortExpression :: SortExpression params tables grouping -> ByteString
423renderSortExpression = \case
443renderSortExpression = \case
@@ -437,7 +457,7 @@ aggregation
439 (tables :: [(Symbol,[(Symbol,ColumnType)])])
459 (tables :: [(Symbol,[(Symbol,ColumnType)])])
440− (tabcol :: (Symbol,Symbol)) where
460+ (by :: (Symbol,Symbol)) where
442 :: (tables ~ '[table ::: columns], HasColumn column columns ty)
462 :: (tables ~ '[table ::: columns], HasColumn column columns ty)
443 => Alias column
463 => Alias column
@@ -446,6 +466,9 @@ data By
446 :: (HasTable table tables columns, HasColumn column columns ty)
466 :: (HasTable table tables columns, HasColumn column columns ty)
447 => (Alias table, Alias column)
467 => (Alias table, Alias column)
448 -> By tables '(table, column)
468 -> By tables '(table, column)
469+deriving instance Show (By tables by)
470+deriving instance Eq (By tables by)
471+deriving instance Ord (By tables by)
450renderBy :: By tables tabcolty -> ByteString
473renderBy :: By tables tabcolty -> ByteString
451renderBy = \case
474renderBy = \case
@@ -470,6 +493,9 @@ data HavingClause params tables grouping where
471 :: [Condition params tables ('Grouped bys)]
494 :: [Condition params tables ('Grouped bys)]
472 -> HavingClause params tables ('Grouped bys)
495 -> HavingClause params tables ('Grouped bys)
496+deriving instance Show (HavingClause params tables grouping)
497+deriving instance Eq (HavingClause params tables grouping)
498+deriving instance Ord (HavingClause params tables grouping)
474renderHavingClause :: HavingClause params tables grouping -> ByteString
500renderHavingClause :: HavingClause params tables grouping -> ByteString
475renderHavingClause = \case
501renderHavingClause = \case
@@ -515,74 +541,97 @@ instance
515 ) => IsTableColumn table column
541 ) => IsTableColumn table column
516 (Expression params tables ('Grouped bys) ty) where (!) = getGroup2
542 (Expression params tables ('Grouped bys) ty) where (!) = getGroup2
544+data AllOrDistinct = All | Distinct
545+ deriving (GHC.Generic,Show,Eq,Ord,Data)
546+instance NFData AllOrDistinct
548+renderAllOrDistinct :: AllOrDistinct -> ByteString
549+renderAllOrDistinct = \case
551+ Distinct -> "DISTINCT"
518unsafeAggregate
553unsafeAggregate
519 :: ByteString
554 :: ByteString
520 -> Expression params tables 'Ungrouped ('Required xty)
556 -> Expression params tables 'Ungrouped ('Required xty)
521 -> Expression params tables ('Grouped bys) ('Required yty)
557 -> Expression params tables ('Grouped bys) ('Required yty)
522−unsafeAggregate fun x = UnsafeExpression $ mconcat
558+unsafeAggregate fun allOrDistinct x = UnsafeExpression $ mconcat
523− [fun, "(", renderExpression x, ")"]
559+ [fun, "(", renderAllOrDistinct allOrDistinct <+> renderExpression x, ")"]
526 :: PGNum ty
562 :: PGNum ty
527− => Expression params tables 'Ungrouped ('Required (nullity ty))
564+ -> Expression params tables 'Ungrouped ('Required (nullity ty))
528 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
565 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
529sum_ = unsafeAggregate "sum"
566sum_ = unsafeAggregate "sum"
532 :: PGIntegral int
569 :: PGIntegral int
533− => Expression params tables 'Ungrouped ('Required (nullity int))
571+ -> Expression params tables 'Ungrouped ('Required (nullity int))
534 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGnumeric))
572 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGnumeric))
535avgInt = unsafeAggregate "avg"
573avgInt = unsafeAggregate "avg"
538 :: PGFloating float
576 :: PGFloating float
539− => Expression params tables 'Ungrouped ('Required (nullity float))
578+ -> Expression params tables 'Ungrouped ('Required (nullity float))
540 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGfloat8))
579 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGfloat8))
541avgFloat = unsafeAggregate "avg"
580avgFloat = unsafeAggregate "avg"
544 :: PGIntegral int
583 :: PGIntegral int
545− => Expression params tables 'Ungrouped ('Required (nullity int))
585+ -> Expression params tables 'Ungrouped ('Required (nullity int))
546 -> Expression params tables ('Grouped bys) ('Required (nullity int))
586 -> Expression params tables ('Grouped bys) ('Required (nullity int))
547bitAnd = unsafeAggregate "bit_and"
587bitAnd = unsafeAggregate "bit_and"
550 :: PGIntegral int
590 :: PGIntegral int
551− => Expression params tables 'Ungrouped ('Required (nullity int))
592+ -> Expression params tables 'Ungrouped ('Required (nullity int))
552 -> Expression params tables ('Grouped bys) ('Required (nullity int))
593 -> Expression params tables ('Grouped bys) ('Required (nullity int))
553bitOr = unsafeAggregate "bit_or"
594bitOr = unsafeAggregate "bit_or"
556− :: Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
598+ -> Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
557 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
599 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
558boolAnd = unsafeAggregate "bool_and"
600boolAnd = unsafeAggregate "bool_and"
561− :: Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
604+ -> Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
562 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
605 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
563boolOr = unsafeAggregate "bool_or"
606boolOr = unsafeAggregate "bool_or"
566− :: Expression params table ('Grouped bys) ('Required ('NotNull 'PGint8))
610+ -> Expression params table ('Grouped bys) ('Required ('NotNull 'PGint8))
567−countStar = UnsafeExpression "count(*)"
611+countStar allOrDistinct = UnsafeExpression $
612+ "count(" <> renderAllOrDistinct allOrDistinct <+> "*)"
570− :: Expression params tables 'Ungrouped ('Required ty)
616+ -> Expression params tables 'Ungrouped ('Required ty)
571 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGint8))
617 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGint8))
572count = unsafeAggregate "count"
618count = unsafeAggregate "count"
575− :: Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
622+ -> Expression params tables 'Ungrouped ('Required (nullity 'PGbool))
576 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
623 -> Expression params tables ('Grouped bys) ('Required (nullity 'PGbool))
577every = unsafeAggregate "every"
624every = unsafeAggregate "every"
580− :: Expression params tables 'Ungrouped ('Required ty)
628+ -> Expression params tables 'Ungrouped ('Required ty)
581 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjson))
629 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjson))
582jsonAgg = unsafeAggregate "json_agg"
630jsonAgg = unsafeAggregate "json_agg"
585− :: Expression params tables 'Ungrouped ('Required ty)
634+ -> Expression params tables 'Ungrouped ('Required ty)
586 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjsonb))
635 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjsonb))
587jsonbAgg = unsafeAggregate "jsonb_agg"
636jsonbAgg = unsafeAggregate "jsonb_agg"
@@ -595,20 +644,23 @@ jsonObjectAgg k v = UnsafeExpression $
595 <> ", " <> renderExpression v <> ")"
644 <> ", " <> renderExpression v <> ")"
597jsonbObjectAgg
646jsonbObjectAgg
598− :: Expression params tables 'Ungrouped ('Required ('NotNull keyty))
648+ -> Expression params tables 'Ungrouped ('Required ('NotNull keyty))
599 -> Expression params tables 'Ungrouped ('Required valty)
649 -> Expression params tables 'Ungrouped ('Required valty)
600 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjsonb))
650 -> Expression params tables ('Grouped bys) ('Required ('NotNull 'PGjsonb))
601−jsonbObjectAgg k v = UnsafeExpression $
651+jsonbObjectAgg allOrDistinct k v = UnsafeExpression $
602− "jsonb_object_agg(" <> renderExpression k
652+ "jsonb_object_agg(" <> renderAllOrDistinct allOrDistinct
603− <> ", " <> renderExpression v <> ")"
653+ <+> renderExpression k <> ", " <> renderExpression v <> ")"
606− :: Expression params tables 'Ungrouped ('Required (nullity ty))
657+ -> Expression params tables 'Ungrouped ('Required (nullity ty))
607 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
658 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
608max_ = unsafeAggregate "max"
659max_ = unsafeAggregate "max"
611− :: Expression params tables 'Ungrouped ('Required (nullity ty))
663+ -> Expression params tables 'Ungrouped ('Required (nullity ty))
612 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
664 -> Expression params tables ('Grouped bys) ('Required (nullity ty))
613min_ = unsafeAggregate "min"
665min_ = unsafeAggregate "min"
@@ -620,7 +672,7 @@ newtype Table
620 (schema :: [(Symbol,[(Symbol,ColumnType)])])
672 (schema :: [(Symbol,[(Symbol,ColumnType)])])
621 (columns :: [(Symbol,ColumnType)])
673 (columns :: [(Symbol,ColumnType)])
622 = UnsafeTable { renderTable :: ByteString }
674 = UnsafeTable { renderTable :: ByteString }
623− deriving (Show,Eq)
675+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
625class KnownSymbol table => HasTable table tables columns
677class KnownSymbol table => HasTable table tables columns
626 | table tables -> columns where
678 | table tables -> columns where
@@ -785,7 +837,7 @@ type expressions
786newtype TypeExpression (ty :: ColumnType)
838newtype TypeExpression (ty :: ColumnType)
787 = UnsafeTypeExpression { renderTypeExpression :: ByteString }
839 = UnsafeTypeExpression { renderTypeExpression :: ByteString }
788− deriving (Show,Eq)
840+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
790bool :: TypeExpression ('Required ('Null 'PGbool))
842bool :: TypeExpression ('Required ('Null 'PGbool))
791bool = UnsafeTypeExpression "bool"
843bool = UnsafeTypeExpression "bool"
@@ -911,6 +963,7 @@ newtype Definition
911 (schema0 :: [(Symbol,[(Symbol,ColumnType)])])
963 (schema0 :: [(Symbol,[(Symbol,ColumnType)])])
912 (schema1 :: [(Symbol,[(Symbol,ColumnType)])])
964 (schema1 :: [(Symbol,[(Symbol,ColumnType)])])
913 = UnsafeDefinition { renderDefinition :: ByteString }
965 = UnsafeDefinition { renderDefinition :: ByteString }
966+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
915instance Category Definition where
968instance Category Definition where
916 id = UnsafeDefinition ";"
969 id = UnsafeDefinition ";"
@@ -922,12 +975,14 @@ newtype Manipulation
922 (params :: [ColumnType])
975 (params :: [ColumnType])
923 (columns :: [(Symbol,ColumnType)])
976 (columns :: [(Symbol,ColumnType)])
924 = UnsafeManipulation { renderManipulation :: ByteString }
977 = UnsafeManipulation { renderManipulation :: ByteString }
978+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
926newtype Query
980newtype Query
927 (schema :: [(Symbol,[(Symbol,ColumnType)])])
981 (schema :: [(Symbol,[(Symbol,ColumnType)])])
928 (params :: [ColumnType])
982 (params :: [ColumnType])
929 (columns :: [(Symbol,ColumnType)])
983 (columns :: [(Symbol,ColumnType)])
930 = UnsafeQuery { renderQuery :: ByteString }
984 = UnsafeQuery { renderQuery :: ByteString }
985+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
932queryStatement
987queryStatement
933 :: Query schema params columns
988 :: Query schema params columns
@@ -977,12 +1032,29 @@ select list tabs = UnsafeQuery $
977 <+> renderCommaSeparated (renderAliased renderExpression) list
1032 <+> renderCommaSeparated (renderAliased renderExpression) list
978 <+> renderTableExpression tabs
1033 <+> renderTableExpression tabs
1037+ => NP (Aliased (Expression params tables grouping)) (column ': columns)
1038+ -> TableExpression params schema tables grouping
1039+ -> Query schema params (column ': columns)
1040+selectDistinct list tabs = UnsafeQuery $
1042+ <+> renderCommaSeparated (renderAliased renderExpression) list
1043+ <+> renderTableExpression tabs
980selectStar
1045selectStar
981 :: tables ~ '[table ::: columns]
1046 :: tables ~ '[table ::: columns]
982 => TableExpression params schema tables 'Ungrouped
1047 => TableExpression params schema tables 'Ungrouped
983 -> Query schema params columns
1048 -> Query schema params columns
984selectStar tabs = UnsafeQuery $ "SELECT" <+> "*" <+> renderTableExpression tabs
1049selectStar tabs = UnsafeQuery $ "SELECT" <+> "*" <+> renderTableExpression tabs
1052+ :: tables ~ '[table ::: columns]
1053+ => TableExpression params schema tables 'Ungrouped
1054+ -> Query schema params columns
1055+selectDistinctStar tabs = UnsafeQuery $
1056+ "SELECT DISTINCT" <+> "*" <+> renderTableExpression tabs
986selectDotStar
1058selectDotStar
987 :: HasTable table tables columns
1059 :: HasTable table tables columns
988 => Alias table
1060 => Alias table
@@ -991,12 +1063,14 @@ selectDotStar
991selectDotStar table tables = UnsafeQuery $
1063selectDotStar table tables = UnsafeQuery $
992 "SELECT" <+> renderAlias table <> ".*" <+> renderTableExpression tables
1064 "SELECT" <+> renderAlias table <> ".*" <+> renderTableExpression tables
994−selectRow
1066+selectDistinctDotStar
995− :: SListI columns
1067+ :: HasTable table tables columns
996− => NP (Aliased (Expression params '[] 'Ungrouped)) columns
1068+ => Alias table
1069+ -> TableExpression params schema tables 'Ungrouped
997 -> Query schema params columns
1070 -> Query schema params columns
998−selectRow row = UnsafeQuery $
1071+selectDistinctDotStar table tables = UnsafeQuery $
999− "SELECT" <+> renderCommaSeparated (renderAliased renderExpression) row
1072+ "SELECT DISTINCT" <+> renderAlias table <> ".*"
1073+ <+> renderTableExpression tables
1001{-----------------------------------------
1075{-----------------------------------------
1002CREATE statements
1076CREATE statements
@@ -1023,10 +1097,11 @@ createTable table columns constraints = UnsafeDefinition $
1023 [] -> ""
1097 [] -> ""
1024 _ -> ", " <> commaSeparated (renderTableConstraint <$> constraints)
1098 _ -> ", " <> commaSeparated (renderTableConstraint <$> constraints)
1026−data TableConstraint
1100+newtype TableConstraint
1027 (schema :: [(Symbol,[(Symbol,ColumnType)])])
1101 (schema :: [(Symbol,[(Symbol,ColumnType)])])
1028 (columns :: [(Symbol,ColumnType)])
1102 (columns :: [(Symbol,ColumnType)])
1029− = UnsafeTableConstraint { renderTableConstraint :: ByteString }
1103+ = UnsafeTableConstraint { renderTableConstraint :: ByteString }
1104+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
1032 :: Condition '[] '[table ::: columns] 'Ungrouped
1107 :: Condition '[] '[table ::: columns] 'Ungrouped
@@ -1034,15 +1109,6 @@ check
1034check condition = UnsafeTableConstraint $
1109check condition = UnsafeTableConstraint $
1035 "CHECK" <+> parenthesized (renderExpression condition)
1110 "CHECK" <+> parenthesized (renderExpression condition)
1038− (columns :: [(Symbol,ColumnType)])
1039− (columnty :: (Symbol,ColumnType))
1042− :: HasColumn column columns ty
1044− -> Column columns (column ::: ty)
1046renderColumn :: Column columns columnty -> ByteString
1112renderColumn :: Column columns columnty -> ByteString
1047renderColumn (Column column) = renderAlias column
1113renderColumn (Column column) = renderAlias column
@@ -1084,6 +1150,8 @@ data OnDelete
1084 = OnDeleteNoAction
1150 = OnDeleteNoAction
1085 | OnDeleteRestrict
1151 | OnDeleteRestrict
1086 | OnDeleteCascade
1152 | OnDeleteCascade
1153+ deriving (GHC.Generic,Show,Eq,Ord,Data)
1154+instance NFData OnDelete
1088renderOnDelete :: OnDelete -> ByteString
1156renderOnDelete :: OnDelete -> ByteString
1089renderOnDelete = \case
1157renderOnDelete = \case
@@ -1095,6 +1163,8 @@ data OnUpdate
1095 = OnUpdateNoAction
1163 = OnUpdateNoAction
1096 | OnUpdateRestrict
1164 | OnUpdateRestrict
1097 | OnUpdateCascade
1165 | OnUpdateCascade
1166+ deriving (GHC.Generic,Show,Eq,Ord,Data)
1167+instance NFData OnUpdate
1099renderOnUpdate :: OnUpdate -> ByteString
1169renderOnUpdate :: OnUpdate -> ByteString
1100renderOnUpdate = \case
1170renderOnUpdate = \case
@@ -1136,10 +1206,11 @@ alterTableRename table0 table1 = UnsafeDefinition $
1136 "ALTER TABLE" <+> renderAlias table0
1206 "ALTER TABLE" <+> renderAlias table0
1137 <+> "RENAME TO" <+> renderAlias table1 <> ";"
1207 <+> "RENAME TO" <+> renderAlias table1 <> ";"
1139−data AlterTable
1209+newtype AlterTable
1140 (columns0 :: [(Symbol, ColumnType)])
1210 (columns0 :: [(Symbol, ColumnType)])
1141 (columns1 :: [(Symbol, ColumnType)]) =
1211 (columns1 :: [(Symbol, ColumnType)]) =
1142 UnsafeAlterTable {renderAlterTable :: ByteString}
1212 UnsafeAlterTable {renderAlterTable :: ByteString}
1213+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
1144addColumnDefault
1215addColumnDefault
1145 :: KnownSymbol column
1216 :: KnownSymbol column
@@ -1180,8 +1251,9 @@ alterColumn
1180alterColumn column alteration = UnsafeAlterTable $
1251alterColumn column alteration = UnsafeAlterTable $
1181 "ALTER COLUMN" <+> renderAlias column <+> renderAlterColumn alteration
1252 "ALTER COLUMN" <+> renderAlias column <+> renderAlterColumn alteration
1183−data AlterColumn (ty0 :: ColumnType) (ty1 :: ColumnType) =
1254+newtype AlterColumn (ty0 :: ColumnType) (ty1 :: ColumnType) =
1184 UnsafeAlterColumn {renderAlterColumn :: ByteString}
1255 UnsafeAlterColumn {renderAlterColumn :: ByteString}
1256+ deriving (GHC.Generic,Show,Eq,Ord,Data,NFData)
1186setDefault
1258setDefault
1187 :: Expression '[] '[] 'Ungrouped ('Required ty)
1259 :: Expression '[] '[] 'Ungrouped ('Required ty)
@@ -1226,10 +1298,10 @@ data ValuesClause
1226 (schema :: [(Symbol,[(Symbol,ColumnType)])])
1298 (schema :: [(Symbol,[(Symbol,ColumnType)])])
1227 (params :: [ColumnType])
1299 (params :: [ColumnType])
1228 (columns :: [(Symbol,ColumnType)])
1300 (columns :: [(Symbol,ColumnType)])
1229− = Values
1301+ = Values
1230− (NP (Aliased (Expression params '[] 'Ungrouped)) columns)
1302+ (NP (Aliased (Expression params '[] 'Ungrouped)) columns)
1231− [NP (Aliased (Expression params '[] 'Ungrouped)) columns]
1303+ [NP (Aliased (Expression params '[] 'Ungrouped)) columns]
1232− | ValuesQuery (Query schema params columns)
1304+ | ValuesQuery (Query schema params columns)
1234renderValuesClause
1306renderValuesClause
1235 :: SListI columns
1307 :: SListI columns
@@ -1299,6 +1371,9 @@ UPDATE statements
1299data UpdateExpression params columns ty
1371data UpdateExpression params columns ty
1301 | Set (forall table. Expression params '[table ::: columns] 'Ungrouped ty)
1373 | Set (forall table. Expression params '[table ::: columns] 'Ungrouped ty)
1374+deriving instance Show (UpdateExpression params columns ty)
1375+deriving instance Eq (UpdateExpression params columns ty)
1376+deriving instance Ord (UpdateExpression params columns ty)
1303renderUpdateExpression
1378renderUpdateExpression
1304 :: Aliased (UpdateExpression params columns) column
1379 :: Aliased (UpdateExpression params columns) column