@@ -292,6 +292,9 @@ param = parameter @n (pgtype @schemas)
292292instance (HasUnique tab from row, Has col row ty)
293293 => IsLabel col (Expression 'Ungrouped commons schemas params from ty) where
294294 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
295298instance (HasUnique tab from row, Has col row ty, column ~ (col ::: ty))
296299 => IsLabel col
297300 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
@@ -305,6 +308,9 @@ instance (Has tab from row, Has col row ty)
305308 => IsQualified tab col (Expression 'Ungrouped commons schemas params from ty) where
306309 tab ! col = UnsafeExpression $
307310 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
308314instance (Has tab from row, Has col row ty, column ~ (col ::: ty))
309315 => IsQualified tab col
310316 (Aliased (Expression 'Ungrouped commons schemas params from) column) where
@@ -321,6 +327,14 @@ instance
321327 ) => IsLabel col
322328 (Expression ('Grouped bys) commons schemas params from ty) where
323329 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
330+instance
331+ ( HasUnique tab from row
332+ , Has col row ty
333+ , GroupedBy tab col bys
334+ , tys ~ '[ty]
335+ ) => IsLabel col
336+ (NP (Expression ('Grouped bys) commons schemas params from) tys) where
337+ fromLabel = fromLabel @col :* Nil
324338instance
325339 ( HasUnique tab from row
326340 , Has col row ty
@@ -346,6 +360,14 @@ instance
346360 (Expression ('Grouped bys) commons schemas params from ty) where
347361 tab ! col = UnsafeExpression $
348362 renderSQL tab <> "." <> renderSQL col
363+instance
364+ ( Has tab from row
365+ , Has col row ty
366+ , GroupedBy tab col bys
367+ , tys ~ '[ty]
368+ ) => IsQualified tab col
369+ (NP (Expression ('Grouped bys) commons schemas params from) tys) where
370+ tab ! col = tab ! col :* Nil
349371instance
350372 ( Has tab from row
351373 , Has col row ty