korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.48k stars 222 forks source link

not= query is throwing a PSQLException #289

Open NeilMenne opened 9 years ago

NeilMenne commented 9 years ago

The exception is a syntax error.

I am doing something like:

(select my_table (where (not= :boolcolumn false)))

This throws an exception stating that there's a syntax error at or near $1 which is what should be the false.

As a further attempt at digging into the problem, I tried:

(exec-raw ["SELECT * FROM my_table WHERE boolcolumn IS NOT ?" [false]] :results)

This returns the same exception.

I am using version 9.3.5 of PostgresSQL and the following from my project file:

[korma "0.4.0"]
[org.postgresql/postgresql "9.4-1201-jdbc4"]
immoh commented 9 years ago

Seems to be a bug, not= is not handled correctly. You can use

(where (not (= :boolcolumn false)))

which should work ok.

NeilMenne commented 9 years ago

Yeah, I can confirm that this works.

Thanks!