(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}))
(write-uuid-jdbc u1 "jdbc")
(write-uuid-clojureql u2 "clojureql")
Now write u2 with jdbc:Bad value for type int : d812274a-a1ff-4ce5-962e-005f3c893459[Thrown class org.postgresql.util.PSQLException]Restarts:0: [QUIT] Quit to the SLIME top levelBacktrace:0: org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2759)1: org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2003)
(write-uuid-jdbc u2 "jdbc")
(read-table-clojureql)({:name "jdbc", :uid #<UUID 2896de2b-2c48-40ab-83a6-cee6c2be16cd>}{:name "jdbc", :uid #<UUID d812274a-a1ff-4ce5-962e-005f3c893459>})
: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"]])
The stack trace from ClojureQL originates in its function to return
generated keys and it's calling .getInt on the (generated) key which
fails because it's a UUID.
So the question is probably: why is ClojureQL assuming all generated
keys are integers?
As for what might have changed in Don's setup, I wondered if the :uid
column definition had been changed to indicate (to ClojureQL) that it
is a potentially generated key?
(is there a ClojureQL mailing list?)
Sean
It shouldn't, and doesn't now:
https://github.com/LauJensen/clojureql/commit/f7ffe88b166e6f60eccb3b4f46b7db5d69dbcc64
Thanks for tracing this and taking the time to post it.
> As for what might have changed in Don's setup, I wondered if the :uid
> column definition had been changed to indicate (to ClojureQL) that it
> is a potentially generated key?
CQL doesn't distinguish generated and non-generated. It just exposes
the notion, JDBC provides of that.
> (is there a ClojureQL mailing list?)
Not that I'm aware of, currently.
kind regards
--
__________________________________________________________________
Herwig Hochleitner
That looks like the fix Don needs! Thanx for the swift response.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
> On Tue, Dec 6, 2011 at 6:12 AM, Herwig Hochleitner
> <hhochl...@gmail.com> wrote:
>> 2011/12/6 Sean Corfield <seanco...@gmail.com>:
>>> So the question is probably: why is ClojureQL assuming all generated
>>> keys are integers?
>> It shouldn't, and doesn't now:
>> https://github.com/LauJensen/clojureql/commit/f7ffe88b166e6f60eccb3b4f46b7db5d69dbcc64
>> Thanks for tracing this and taking the time to post it.
I have confirmed that this change/commit fixes my/the problem!
Thank you Herwig for the fix, and thank you Sean for narrowing the problem down!