Hi Daniel,
Thanks for the code. However, :coerce is already there, named :type, and the way to-sql-string is currently used, it should A) not use S-SQL functions, since cl-postgres does not depend on S-SQL, and B) serialise to a format that can also be used to pass parameters to prepared queries. I'm not that knowledgeable about Postgres' textual formats, but it appears that a value like ARRAY[1, 2, 3] can not be written as a parameter:
Database error 22P02: array value must start with "{" or dimension information
If you feel like getting to the bottom of this, feel free to submit an alternative patch. If not, array serialisation will have to wait a bit more.
Best, Marijn