@@ -129,6 +129,17 @@ instance Boolean (Expression params tables ('NotNull 'PGBool)) where
129129type instance BooleanOf (Expression params tables ty) =
130130 Expression params tables ('NotNull 'PGBool)
131131
132+coalesce
133+ :: [Expression params tables ('Null x)]
134+ -> Expression params tables ('NotNull x)
135+ -> Expression params tables ('NotNull x)
136+coalesce nulls notNull = UnsafeExpression $ mconcat
137+ [ "COALESCE("
138+ , ByteString.intercalate ", " $ map renderExpression nulls
139+ , ", ", renderExpression notNull
140+ , ")"
141+ ]
142+
132143caseWhenThenElse
133144 :: [(Expression params tables ('NotNull 'PGBool), Expression params tables ty)]
134145 -> Expression params tables ty