auto escaping "NULL"
Jacob Joseph <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi.
Upon trying to insert NULL values into a double precision field, I
receive the error:
DataError: invalid input syntax for type double precision: "NULL"
LINE 4: (2, -1, E'NULL', 1.11,
I'm using a statement like:
curs.execute("INSERT INTO foo (distance) VALUES (%(dist)s)", {'dist':
None})
Should I expect this statement to work? Removing the quotes from NULL
seems to be correct.
As a related question, what is the correct way to use the execute(s,
args) syntax, but *not* escape a particular variable? Not so
infrequently, I'd like to use an argument to add an SQL command, such
as adding to a WHERE or specifying a field.
(I'm using 2.0.12 and postgres 8.4.)
Thanks,
~Jacob
_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFLGEjDMpwSl5zyBnARAi5uAJ4qBt3GZNYbY1bqLTGCWM/EpiXvsACeNxK+ 6Z0KooEf+lHbJ8z6WByc+fc= =7Lz5 -----END PGP SIGNATURE-----