@@ -81,6 +81,7 @@ module Squeal.PostgreSQL.Query
8181 , table
8282 , subquery
8383 , view
84+ , common
8485 , crossJoin
8586 , innerJoin
8687 , leftOuterJoin
@@ -144,12 +145,11 @@ is called a `Query`. Let's see some examples of queries.
144145
145146simple query:
146147
148+>>> type Columns = '["col1" ::: 'NoDef :=> 'NotNull 'PGint4, "col2" ::: 'NoDef :=> 'NotNull 'PGint4]
149+>>> type Schema = '["tab" ::: 'Table ('[] :=> Columns)]
147150>>> :{
148151let
149− query :: Query
150− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
151− '[]
152− '["col" ::: 'Null 'PGint4]
152+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
153153 query = selectStar (from (table #tab))
154154in printSQL query
155155:}
@@ -159,16 +159,9 @@ restricted query:
159159
160160>>> :{
161161let
162− query :: Query
163− '[ "public" ::: '[ "tab" ::: 'Table ('[] :=>
164− '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
165− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]]
166− '[]
167− '[ "sum" ::: 'NotNull 'PGint4
168− , "col1" ::: 'NotNull 'PGint4 ]
162+ query :: Query (DBof (Public Schema)) '[] '["sum" ::: 'NotNull 'PGint4, "col1" ::: 'NotNull 'PGint4]
169163 query =
170− select
171− ((#col1 + #col2) `as` #sum :* #col1)
164+ select ((#col1 + #col2) `as` #sum :* #col1)
172165 ( from (table #tab)
173166 & where_ (#col1 .> #col2)
174167 & where_ (#col2 .> 0) )
@@ -180,13 +173,8 @@ subquery:
180173
181174>>> :{
182175let
183− query :: Query
184− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
185− '[]
186− '["col" ::: 'Null 'PGint4]
187− query =
188− selectStar
189− (from (subquery (selectStar (from (table #tab)) `as` #sub)))
176+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
177+ query = selectStar (from (subquery (selectStar (from (table #tab)) `as` #sub)))
190178in printSQL query
191179:}
192180SELECT * FROM (SELECT * FROM "tab" AS "tab") AS "sub"
@@ -195,12 +183,8 @@ limits and offsets:
195183
196184>>> :{
197185let
198− query :: Query
199− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
200− '[]
201− '["col" ::: 'Null 'PGint4]
202− query = selectStar
203− (from (table #tab) & limit 100 & offset 2 & limit 50 & offset 2)
186+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
187+ query = selectStar (from (table #tab) & limit 100 & offset 2 & limit 50 & offset 2)
204188in printSQL query
205189:}
206190SELECT * FROM "tab" AS "tab" LIMIT 50 OFFSET 4
@@ -209,27 +193,17 @@ parameterized query:
209193
210194>>> :{
211195let
212− query :: Query
213− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGfloat8])]]
214− '[ 'NotNull 'PGfloat8]
215− '["col" ::: 'NotNull 'PGfloat8]
216− query = selectStar
217− (from (table #tab) & where_ (#col .> param @1))
196+ query :: Query (DBof (Public Schema)) '[ 'NotNull 'PGint4] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
197+ query = selectStar (from (table #tab) & where_ (#col1 .> param @1))
218198in printSQL query
219199:}
220−SELECT * FROM "tab" AS "tab" WHERE ("col" > ($1 :: float8))
200+SELECT * FROM "tab" AS "tab" WHERE ("col1" > ($1 :: int4))
221201
222202aggregation query:
223203
224204>>> :{
225205let
226− query :: Query
227− '["public" ::: '[ "tab" ::: 'Table ('[] :=>
228− '[ "col1" ::: 'NoDef :=> 'NotNull 'PGint4
229− , "col2" ::: 'NoDef :=> 'NotNull 'PGint4 ])]]
230− '[]
231− '[ "sum" ::: 'NotNull 'PGint4
232− , "col1" ::: 'NotNull 'PGint4 ]
206+ query :: Query (DBof (Public Schema)) '[] '["sum" ::: 'NotNull 'PGint4, "col1" ::: 'NotNull 'PGint4 ]
233207 query =
234208 select (sum_ #col2 `as` #sum :* #col1)
235209 ( from (table (#tab `as` #table1))
@@ -243,42 +217,43 @@ sorted query:
243217
244218>>> :{
245219let
246− query :: Query
247− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
248− '[]
249− '["col" ::: 'Null 'PGint4]
250− query = selectStar
251− (from (table #tab) & orderBy [#col & AscNullsFirst])
220+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
221+ query = selectStar (from (table #tab) & orderBy [#col1 & Asc])
252222in printSQL query
253223:}
254−SELECT * FROM "tab" AS "tab" ORDER BY "col" ASC NULLS FIRST
224+SELECT * FROM "tab" AS "tab" ORDER BY "col1" ASC
255225
256226joins:
257227
258228>>> :set -XFlexibleContexts
229+>>> :{
230+type OrdersColumns =
231+ '[ "id" ::: 'NoDef :=> 'NotNull 'PGint4
232+ , "price" ::: 'NoDef :=> 'NotNull 'PGfloat4
233+ , "customer_id" ::: 'NoDef :=> 'NotNull 'PGint4
234+ , "shipper_id" ::: 'NoDef :=> 'NotNull 'PGint4
235+ ]
236+:}
237+
238+>>> :{
239+type OrdersConstraints =
240+ '["pk_orders" ::: PrimaryKey '["id"]
241+ ,"fk_customers" ::: ForeignKey '["customer_id"] "customers" '["id"]
242+ ,"fk_shippers" ::: ForeignKey '["shipper_id"] "shippers" '["id"] ]
243+:}
244+
245+>>> type NamesColumns = '["id" ::: 'NoDef :=> 'NotNull 'PGint4, "name" ::: 'NoDef :=> 'NotNull 'PGtext]
246+>>> type NamesConstraints = '["pk_customers" ::: PrimaryKey '["id"]]
247+>>> :{
248+type OrdersSchema =
249+ '[ "orders" ::: 'Table (OrdersConstraints :=> OrdersColumns)
250+ , "customers" ::: 'Table (NamesConstraints :=> NamesColumns)
251+ , "shippers" ::: 'Table (NamesConstraints :=> NamesColumns) ]
252+:}
253+
259254>>> :{
260255let
261− query :: Query
262− '["public" ::: '[ "orders" ::: 'Table (
263− '["pk_orders" ::: PrimaryKey '["id"]
264− ,"fk_customers" ::: ForeignKey '["customer_id"] "customers" '["id"]
265− ,"fk_shippers" ::: ForeignKey '["shipper_id"] "shippers" '["id"]] :=>
266− '[ "id" ::: 'NoDef :=> 'NotNull 'PGint4
267− , "price" ::: 'NoDef :=> 'NotNull 'PGfloat4
268− , "customer_id" ::: 'NoDef :=> 'NotNull 'PGint4
269− , "shipper_id" ::: 'NoDef :=> 'NotNull 'PGint4
270− ])
271− , "customers" ::: 'Table (
272− '["pk_customers" ::: PrimaryKey '["id"]] :=>
273− '[ "id" ::: 'NoDef :=> 'NotNull 'PGint4
274− , "name" ::: 'NoDef :=> 'NotNull 'PGtext
275− ])
276− , "shippers" ::: 'Table (
277− '["pk_shippers" ::: PrimaryKey '["id"]] :=>
278− '[ "id" ::: 'NoDef :=> 'NotNull 'PGint4
279− , "name" ::: 'NoDef :=> 'NotNull 'PGtext
280− ])
281− ]]
256+ query :: Query (DBof (Public OrdersSchema))
282257 '[]
283258 '[ "order_price" ::: 'NotNull 'PGfloat4
284259 , "customer_name" ::: 'NotNull 'PGtext
@@ -301,12 +276,8 @@ self-join:
301276
302277>>> :{
303278let
304− query :: Query
305− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
306− '[]
307− '["col" ::: 'Null 'PGint4]
308− query = selectDotStar #t1
309− (from (table (#tab `as` #t1) & crossJoin (table (#tab `as` #t2))))
279+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
280+ query = selectDotStar #t1 (from (table (#tab `as` #t1) & crossJoin (table (#tab `as` #t2))))
310281in printSQL query
311282:}
312283SELECT "t1".* FROM "tab" AS "t1" CROSS JOIN "tab" AS "t2"
@@ -325,14 +296,8 @@ set operations:
325296
326297>>> :{
327298let
328− query :: Query
329− '["public" ::: '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'Null 'PGint4])]]
330− '[]
331− '["col" ::: 'Null 'PGint4]
332− query =
333− selectStar (from (table #tab))
334− `unionAll`
335− selectStar (from (table #tab))
299+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
300+ query = selectStar (from (table #tab)) `unionAll` selectStar (from (table #tab))
336301in printSQL query
337302:}
338303(SELECT * FROM "tab" AS "tab") UNION ALL (SELECT * FROM "tab" AS "tab")
@@ -341,20 +306,14 @@ with queries:
341306
342307>>> :{
343308let
344− query :: Query
345− '["public" ::: '[ "t1" ::: 'View
346− '[ "c1" ::: 'NotNull 'PGtext
347− , "c2" ::: 'NotNull 'PGtext] ]]
348− '[]
349− '[ "c1" ::: 'NotNull 'PGtext
350− , "c2" ::: 'NotNull 'PGtext ]
309+ query :: Query (DBof (Public Schema)) '[] '["col1" ::: 'NotNull 'PGint4, "col2" ::: 'NotNull 'PGint4]
351310 query = with (
352− CommonTableExpression (selectStar (from (view #t1)) `as` #t2) :>>
353− CommonTableExpression (selectStar (from (view #t2)) `as` #t3) :>> Done
354− ) (selectStar (from (view #t3)))
311+ selectStar (from (table #tab)) `as` #cte1 :>>
312+ selectStar (from (common #cte1)) `as` #cte2
313+ ) (selectStar (from (common #cte2)))
355314in printSQL query
356315:}
357−WITH "t2" AS (SELECT * FROM "t1" AS "t1"), "t3" AS (SELECT * FROM "t2" AS "t2") SELECT * FROM "t3" AS "t3"
316+WITH "cte1" AS (SELECT * FROM "tab" AS "tab"), "cte2" AS (SELECT * FROM "cte1" AS "cte1") SELECT * FROM "cte2" AS "cte2"
358317-}
359318newtype Query
360319 (db :: DBType)
@@ -515,7 +474,7 @@ selectDistinctDotStar rel tab = UnsafeQuery $
515474-- but it can be used on its own.
516475--
517476-- >>> type Row = '["a" ::: 'NotNull 'PGint4, "b" ::: 'NotNull 'PGtext]
518−-- >>> let query = values (1 `as` #a :* "one" `as` #b) [] :: Query '[] '[] Row
477+-- >>> let query = values (1 `as` #a :* "one" `as` #b) [] :: Query db '[] Row
519478-- >>> printSQL query
520479-- SELECT * FROM (VALUES (1, E'one')) AS t ("a", "b")
521480values
@@ -879,6 +838,13 @@ view
879838view (vw `As` alias) = UnsafeFromClause $
880839 renderQualifiedAlias vw <+> "AS" <+> renderAlias alias
881840
841+common
842+ :: Has cte commons common
843+ => Aliased Alias (alias ::: cte)
844+ -> FromClause (commons :=> schemas) params '[alias ::: common]
845+common (cte `As` alias) = UnsafeFromClause $
846+ renderAlias cte <+> "AS" <+> renderAlias alias
847+
882848{- | @left & crossJoin right@. For every possible combination of rows from
883849 @left@ and @right@ (i.e., a Cartesian product), the joined table will contain
884850 a row consisting of all columns in @left@ followed by all columns in @right@.
@@ -1132,7 +1098,7 @@ is `true` if any equal subquery row is found.
11321098The result is `false` if no equal row is found
11331099(including the case where the subquery returns no rows).
11341100
1135−>>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1101+>>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11361102>>> printSQL $ myRow `rowIn` values_ myRow
11371103ROW(1, FALSE) IN (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11381104-}
@@ -1151,7 +1117,7 @@ eqAll
11511117 -> Expression db from grp params (nullity 'PGbool)
11521118eqAll = unsafeSubqueryExpression "= ALL"
11531119
1154−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1120+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11551121-- >>> printSQL $ myRow `rowEqAll` values_ myRow
11561122-- ROW(1, FALSE) = ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11571123rowEqAll
@@ -1169,7 +1135,7 @@ eqAny
11691135 -> Expression db from grp params (nullity 'PGbool)
11701136eqAny = unsafeSubqueryExpression "= ANY"
11711137
1172−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1138+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11731139-- >>> printSQL $ myRow `rowEqAny` values_ myRow
11741140-- ROW(1, FALSE) = ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11751141rowEqAny
@@ -1187,7 +1153,7 @@ neqAll
11871153 -> Expression db from grp params (nullity 'PGbool)
11881154neqAll = unsafeSubqueryExpression "<> ALL"
11891155
1190−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1156+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
11911157-- >>> printSQL $ myRow `rowNeqAll` values_ myRow
11921158-- ROW(1, FALSE) <> ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
11931159rowNeqAll
@@ -1205,7 +1171,7 @@ neqAny
12051171 -> Expression db from grp params (nullity 'PGbool)
12061172neqAny = unsafeSubqueryExpression "<> ANY"
12071173
1208−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1174+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12091175-- >>> printSQL $ myRow `rowNeqAny` values_ myRow
12101176-- ROW(1, FALSE) <> ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12111177rowNeqAny
@@ -1223,7 +1189,7 @@ allLt
12231189 -> Expression db from grp params (nullity 'PGbool)
12241190allLt = unsafeSubqueryExpression "ALL <"
12251191
1226−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1192+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12271193-- >>> printSQL $ myRow `rowLtAll` values_ myRow
12281194-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12291195rowLtAll
@@ -1241,7 +1207,7 @@ ltAny
12411207 -> Expression db from grp params (nullity 'PGbool)
12421208ltAny = unsafeSubqueryExpression "ANY <"
12431209
1244−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1210+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12451211-- >>> printSQL $ myRow `rowLtAll` values_ myRow
12461212-- ROW(1, FALSE) ALL < (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12471213rowLtAny
@@ -1259,7 +1225,7 @@ lteAll
12591225 -> Expression db from grp params (nullity 'PGbool)
12601226lteAll = unsafeSubqueryExpression "<= ALL"
12611227
1262−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1228+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12631229-- >>> printSQL $ myRow `rowLteAll` values_ myRow
12641230-- ROW(1, FALSE) <= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12651231rowLteAll
@@ -1277,7 +1243,7 @@ lteAny
12771243 -> Expression db from grp params (nullity 'PGbool)
12781244lteAny = unsafeSubqueryExpression "<= ANY"
12791245
1280−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1246+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12811247-- >>> printSQL $ myRow `rowLteAny` values_ myRow
12821248-- ROW(1, FALSE) <= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
12831249rowLteAny
@@ -1295,7 +1261,7 @@ gtAll
12951261 -> Expression db from grp params (nullity 'PGbool)
12961262gtAll = unsafeSubqueryExpression "> ALL"
12971263
1298−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1264+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
12991265-- >>> printSQL $ myRow `rowGtAll` values_ myRow
13001266-- ROW(1, FALSE) > ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13011267rowGtAll
@@ -1313,7 +1279,7 @@ gtAny
13131279 -> Expression db from grp params (nullity 'PGbool)
13141280gtAny = unsafeSubqueryExpression "> ANY"
13151281
1316−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1282+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
13171283-- >>> printSQL $ myRow `rowGtAny` values_ myRow
13181284-- ROW(1, FALSE) > ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13191285rowGtAny
@@ -1331,7 +1297,7 @@ gteAll
13311297 -> Expression db from grp params (nullity 'PGbool)
13321298gteAll = unsafeSubqueryExpression ">= ALL"
13331299
1334−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1300+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
13351301-- >>> printSQL $ myRow `rowGteAll` values_ myRow
13361302-- ROW(1, FALSE) >= ALL (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13371303rowGteAll
@@ -1349,7 +1315,7 @@ gteAny
13491315 -> Expression db from grp params (nullity 'PGbool)
13501316gteAny = unsafeSubqueryExpression ">= ANY"
13511317
1352−-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression '[] '[] 'Ungrouped '[])) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
1318+-- | >>> let myRow = 1 `as` #foo :* false `as` #bar :: NP (Aliased (Expression db from grp params)) '["foo" ::: 'NotNull 'PGint2, "bar" ::: 'NotNull 'PGbool]
13531319-- >>> printSQL $ myRow `rowGteAny` values_ myRow
13541320-- ROW(1, FALSE) >= ANY (SELECT * FROM (VALUES (1, FALSE)) AS t ("foo", "bar"))
13551321rowGteAny