Frank Miles
2010-05-08 23:46:50 UTC
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!
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Frank Miles