I use psycopg2 and have input varaiables with a where condition that looks like this:
WHERE %(variable)s is null or some_column in %(variable)s
The problem is that when variable is null I get a syntax error:
psycopg2.errors.SyntaxError: syntax error at or near "NULL"`
(NULL is null or (some_column IN NULL)) and
^
That condition should of course not be evaluated since null is null is true already, but the syntax does not pass. Anyway to fix this without creating an extra variable?