@@ -292,6 +292,9 @@ param = parameter @n (pgtype @schemas)
292instance (HasUnique tab from row, Has col row ty)
292instance (HasUnique tab from row, Has col row ty)
293 => IsLabel col (Expression 'Ungrouped commons schemas params from ty) where
293 => IsLabel col (Expression 'Ungrouped commons schemas params from ty) where
294 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
294 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
295+instance (HasUnique tab from row, Has col row ty, tys ~ '[ty])
296+ => IsLabel col (NP (Expression 'Ungrouped commons schemas params from) tys) where
297+ fromLabel = fromLabel @col :* Nil
295instance (HasUnique tab from row, Has col row ty, column ~ (col ::: ty))
298instance (HasUnique tab from row, Has col row ty, column ~ (col ::: ty))
296 => IsLabel col
299 => IsLabel col
297 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
300 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
@@ -305,6 +308,9 @@ instance (Has tab from row, Has col row ty)
305 => IsQualified tab col (Expression 'Ungrouped commons schemas params from ty) where
308 => IsQualified tab col (Expression 'Ungrouped commons schemas params from ty) where
306 tab ! col = UnsafeExpression $
309 tab ! col = UnsafeExpression $
307 renderSQL tab <> "." <> renderSQL col
310 renderSQL tab <> "." <> renderSQL col
311+instance (Has tab from row, Has col row ty, tys ~ '[ty])
312+ => IsQualified tab col (NP (Expression 'Ungrouped commons schemas params from) tys) where
313+ tab ! col = tab ! col :* Nil
308instance (Has tab from row, Has col row ty, column ~ (col ::: ty))
314instance (Has tab from row, Has col row ty, column ~ (col ::: ty))
309 => IsQualified tab col
315 => IsQualified tab col
310 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
316 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
@@ -321,6 +327,14 @@ instance
321 ) => IsLabel col
327 ) => IsLabel col
322 (Expression ('Grouped bys) commons schemas params from ty) where
328 (Expression ('Grouped bys) commons schemas params from ty) where
323 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
329 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
331+ ( HasUnique tab from row
333+ , GroupedBy tab col bys
336+ (NP (Expression ('Grouped bys) commons schemas params from) tys) where
337+ fromLabel = fromLabel @col :* Nil
325 ( HasUnique tab from row
339 ( HasUnique tab from row
326 , Has col row ty
340 , Has col row ty
@@ -346,6 +360,14 @@ instance
346 (Expression ('Grouped bys) commons schemas params from ty) where
360 (Expression ('Grouped bys) commons schemas params from ty) where
347 tab ! col = UnsafeExpression $
361 tab ! col = UnsafeExpression $
348 renderSQL tab <> "." <> renderSQL col
362 renderSQL tab <> "." <> renderSQL col
366+ , GroupedBy tab col bys
368+ ) => IsQualified tab col
369+ (NP (Expression ('Grouped bys) commons schemas params from) tys) where
370+ tab ! col = tab ! col :* Nil
350 ( Has tab from row
372 ( Has tab from row
351 , Has col row ty
373 , Has col row ty