RJMetrics / sweet-liberty

A library for building database-backed RESTful services using Clojure
Apache License 2.0
104 stars 6 forks source link

`query/create-h-sql-where-vector` incompatible with PSQL #17

Open owengalenjones opened 8 years ago

owengalenjones commented 8 years ago

Calling str on something like {:id 4} will result in:

com.rjmetrics.sweet-liberty.db {"raw-query":["SELECT email, id FROM users WHERE id = ?","1"]}

Which throws an error in PSQL, it's not as forgiving as MySQL:

ERROR:  operator does not exist: integer = character varying at character 38
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
awm33 commented 7 years ago

Just ran into this trying to use postgres behind a new service. Looks like sweet-lib forces everything to be a string https://github.com/RJMetrics/sweet-liberty/blob/master/src/com/rjmetrics/sweet_liberty/query.clj#L42

awm33 commented 7 years ago

Is there reasoning for doing that? url-params could be parsed before being passed, query-params would be more difficult.