psycopg NULL

Diez B. Roggisch deets_noospaam at web.de
Wed Feb 18 17:52:14 CET 2004


> # None of these work ...
> #curs.execute('INSERT INTO foo (i) VALUES (%s)' % None)
> #curs.execute('INSERT INTO foo (i) VALUES (%d)' % None)
> #curs.execute('INSERT INTO foo (i) VALUES (%i)' % None)
> #conn.commit()

> Any suggestions?

Try literal NULL - as the statement is a string, the types are figured out
by pg itself:

curs.execute('INSERT INTO foo (i) VALUES (NULL)')

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list