For those of you following along at home, my spate of bad luck continues….
A week or so ago, I was happily writing and reading UUIDs into Postgres with ClojureQL. Then, all of a sudden, it stopped working, and I can't figure out why. Shame on me for not being more careful about documenting when it worked, and what changed. And a lot of stuff changed in the interim… So I wrote small example project to demonstrate the problem: I have verified that I can write UUIDs into Postgres with java.jdbc itself, so that is evidence that the issue is not with java.jdbc, the Postgres JDBC library, nor my Postgres server. (def u1 (. UUID (randomUUID))) (def u2 (. UUID (randomUUID))) (defn write-uuid-jdbc [uid name] (sql/with-connection postgres-db (sql/insert-values :testuuid [:uid :name] [uid name]))) (defn read-table-clojureql [] @(table postgres-db :testuuid)) (defn write-uuid-clojureql [uid name] (conj! (table postgres-db :testuuid) {:uid uid :name name})) This illustrates the problem: (write-uuid-jdbc u1 "jdbc") works. (write-uuid-clojureql u2 "clojureql") throws the following exception: Bad value for type int : d812274a-a1ff-4ce5-962e-005f3c893459 [Thrown class org.postgresql.util.PSQLException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2759) 1: org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2003) Now write u2 with jdbc: (write-uuid-jdbc u2 "jdbc") And read the entire table back out using ClojureQL: (read-table-clojureql) ({:name "jdbc", :uid #<UUID 2896de2b-2c48-40ab-83a6-cee6c2be16cd>} {:name "jdbc", :uid #<UUID d812274a-a1ff-4ce5-962e-005f3c893459>}) So ClojureQL can certainly read the table, and return the UUIDs, but can't write them… Here is the relevant part of project.clj: :dependencies [[org.clojure/clojure "1.2.1"] [postgresql/postgresql "9.1-901.jdbc4"] [org.clojure/java.jdbc "0.1.1"] [clojureql "1.1.0-SNAPSHOT"] ]) I woud definitely appreciate/welcome any suggestions about why this is happening, or how it might be fixed…. I've pushed this example test case/project up to GitHub in case anyone wants to poke around: dcj/postgres-uuid-test Don -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en