On Jul 10, 4:52 pm, Wilfred <[email protected]> wrote:
> I'm at a bit of a loss. "UPDATE comments SET approved='1' WHERE id =
> '1'" works fine in psql. approved is a boolean field, so is this an
> issue with the SQL library producing incorrect SQL?

I think this is an oddity with the JDBC driver for PostgreSQL.  The
driver doesn't seem to like doing automatic typecasting.  Try this:

(sql/update-values :comments
                   ["id = cast(? as integer)" id]
                   ;; alternatively "id = ?::integer"
                   {:approved true})

Or you could (Integer/parseInt id) to do the cast before you pass it
as parameter, though in either case you should validate your id before
casting, if you want to avoid dying on poorly-formed input.

--Brian

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to