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