I can't find a way to insert Postgres' array type with Clojure.
(sql/insert! db :things {:animals ["cow" "pig"]})
Didn't work which I kind of expected. Error message:
PSQLException Can't infer the SQL type to use for an instance of clojure.lang.PersistentVector. Use setObject() with an explicit Types value to specify the type to use. org.postgresql.jdbc2.AbstractJdbc2Statement.setObject (AbstractJdbc2Statement.java:1936)
Even the most direct access to SQL that I could find didn't work:
(sql/execute! db "INSERT INTO things (animals) VALUES ('{\"cow\", \"pig\"}')")
Don't really know what's going on here:
ClassCastException java.lang.Character cannot be cast to java.lang.String clojure.java.jdbc/prepare-statement (jdbc.clj:419)
Surely it must be possible somehow? If not by the helper functions, then by somehow executing raw SQL.