Re: psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone: Options
Jan UrbaĆski <[email protected]> Wed, 31 Mar 2010 01:25:56 +0200
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On 31/03/10 01:16, Anton Shishkov wrote:
> Already tried like you wrote and it worked, but it doesn't suit me, because
> this date can be "NOW() ..." or "2009-11-10".
Them maybe try:
execute("""update x set i = %s::timestamp with time zone - %s::interval
where i = %s""", ("now()", "29 days", "123"))
and
execute("""update x set i = %s::timestamp with time zone - %s::interval
where i = %s""", ("2009-11-10", "0 days", "123"))
or just use different execution paths when you need now() and when you
need a fixed date.
Jan (who forgot to CC the list :( )