@@ -272,12 +272,15 @@ instance ToField NominalDiffTime where
272272 {-# INLINE toField #-}
273273
274274instance (ToField a) => ToField (PGArray a) where
275− toField xs = Many $
276− Plain (byteString "ARRAY[") :
277− (intersperse (Plain (char8 ',')) . map toField $ fromPGArray xs) ++
278− [Plain (char8 ']')]
279− -- Because the ARRAY[...] input syntax is being used, it is possible
280− -- that the use of type-specific separator characters is unnecessary.
275+ toField pgArray =
276+ case fromPGArray pgArray of
277+ [] -> Plain (byteString "'{}'")
278+ xs -> Many $
279+ Plain (byteString "ARRAY[") :
280+ (intersperse (Plain (char8 ',')) . map toField $ xs) ++
281+ [Plain (char8 ']')]
282+ -- Because the ARRAY[...] input syntax is being used, it is possible
283+ -- that the use of type-specific separator characters is unnecessary.
281284
282285instance (ToField a) => ToField (Vector a) where
283286 toField = toField . PGArray . V.toList