copy from org.postgresql.jdbc4.AbstractJdbc4Connection#createArrayOf(..) and org.postgresql.jdbc2.AbstractJdbc2Array#escapeArrayElement(..)
copy from org.postgresql.jdbc4.AbstractJdbc4Connection#createArrayOf(..) and org.postgresql.jdbc2.AbstractJdbc2Array#escapeArrayElement(..)