Idiot's query: proper way to handle NULL in SELECT query?

Frank Miles <[email protected]> Sat, 8 May 2010 16:46:50 -0700
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
As I have slowly been converting my system to use the adaptation
methods, I've been using some direct conversions to handle NULL
data.  It would be nice to be able to:

  cur.execute("SELECT {variable-list} FROM table WHERE var1 = %s AND ... ;", (variable1,...))

without having to pre-check each query, and alter it if one of the
variables might be a None/NULL.  Testing with mogrify shows Nones
being faithfully changed to NULL, but of course postgres doesn't
consider "variable = NULL" equivalent to "variable IS NULL".

Confident that I have missed something blindingly obvious (yet haven't
seen it in the documentation), I ask... what's the normal way of handlng
this?

Thanks!

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Frank Miles