title: Inserting PostgreSQL arrays with Clojure
body: <p>I can't find a way to insert Postgres' array type with Clojure.</p>
  
  <pre><code>(sql/insert! db :things {:animals ["cow" "pig"]})
  </code></pre>
  
  <p>Didn't work which I kind of expected. Error message:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Even the most direct access to SQL that I could find didn't work:</p>
  
  <pre><code>(sql/execute! db "INSERT INTO things (animals) VALUES ('{\"cow\", \"pig\"}')")
  </code></pre>
  
  <p>Don't really know what's going on here:</p>
  
  <pre><code>ClassCastException java.lang.Character cannot be cast to java.lang.String  clojure.java.jdbc/prepare-statement (jdbc.clj:419)
  </code></pre>
  
  <p>Surely it must be possible somehow? If not by the helper functions, then by somehow executing raw SQL.</p>