I’m using psycopg2 to access a postgresql 8.4 database, and on an update query I get the following exception:
File "/home/alf/cubicweb/cubicweb/server/sources/native.py", line 744, in doexec
cursor.execute(str(query), args)
NotSupportedError: ERREUR: la valeur « current » pour la date et heure n'est plus supportée
LINE 1: UPDATE cw_ImportLog SET cw_import_date=E'CURRENT_DATE'
the error message is localized but translates to “the value ‘current’ for date and time is no longer supported”.
What bothers me is that the rest of the error message cleary mentions CURRENT_DATE is being used, and not CURRENT. I can “fix” the exception by using today instead of CURRENT_DATE in my query but I’d like to understand what’s going on in there. Is this a psycopg2 bug?
You are giving the string ‘CURRENT_DATE’ to a date-column. Most likely it uses _ as an accepted separator when parsing the string as a date.
What you want is
CURRENT_DATEnot'CURRENT_DATE'.So try this:
Edit: If you have to feed it a string, use
nowinstead, which is valid. See end of section 9.9.4 in the docs about it.