'NOT IN' condition not working with 'NULL' in list

Viewed 85

I am working on a rails 3.2 application and using postures as database.

Following query, generated by Active Record doesn't work. The code which generates this query is in this question Scope for an optional has_one association with itself.

SELECT "indents".* FROM "indents" WHERE "indents"."type" IN ('Purchase') AND
(id not in (NULL,15017)) ORDER BY indent_date DESC

But if I manually remove the NULL, and try, it works.

SELECT "indents".* FROM "indents" WHERE "indents"."type" IN ('Purchase') AND
(id not in (15017)) ORDER BY indent_date DESC

What is wrong here?

1 Answers
Related