Modify ↓
#10978 closed defect (fixed)
"operator does not exist: bigint = timestamp with time zone" with Postgres
Reported by: | Owned by: | Russ Tyndall | |
---|---|---|---|
Priority: | normal | Component: | TimingAndEstimationPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
I'm not sure what triggers this, or what effect it has, but I'm getting a bunch of these in my trac.log:
2013-03-27 12:21:03,479 Trac[dbhelper] ERROR: There was a problem executing sql:DELETE FROM ticket_change WHERE ticket=%s and author=%s and time=%s and field=%s with parameters:(58138, u'dave', datetime.datetime(2013, 3, 27, 17, 21, 3, 277000, tzinfo=<FixedOffset "UTC" 0:00:00>), 'hours') Exception:operator does not exist: bigint = timestamp with time zone LINE 2: ... WHERE ticket=58138 and author='dave' and time='2013-03-... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. Traceback (most recent call last): File "build\bdist.win32\egg\timingandestimationplugin\dbhelper.py", line 59, in execute_in_trans @env.with_transaction() File "C:\Python27\lib\site-packages\trac-1.0.1-py2.7-win32.egg\trac\db\api.py", line 97, in transaction_wrapper fn(ldb) File "build\bdist.win32\egg\timingandestimationplugin\dbhelper.py", line 65, in fn cur.execute(sql, params) File "C:\Python27\lib\site-packages\trac-1.0.1-py2.7-win32.egg\trac\db\util.py", line 65, in execute return self.cursor.execute(sql_escape_percent(sql), args) ProgrammingError: operator does not exist: bigint = timestamp with time zone LINE 2: ... WHERE ticket=58138 and author='dave' and time='2013-03-... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
TimingAndEstimationPlugin 0.12 with permissions branch, Trac 1.0.1, PostgreSQL database.
Perhaps this is the fix?
-
timingandestimationplugin/ticket_daemon.py
69 69 70 70 def delete_ticket_change( comp, ticket_id, author, change_time, field): 71 71 """ removes a ticket change from the database """ 72 if type(change_time) == datetime.datetime: 73 change_time = to_timestamp(change_time) 72 74 sql = """DELETE FROM ticket_change 73 75 WHERE ticket=%s and author=%s and time=%s and field=%s""" 74 76 dbhelper.execute_non_query(comp.env, sql, ticket_id, author, change_time, field)
Attachments (0)
Change History (4)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for the bug report and proposed fix! I am using the non-permissions branch primarily, so I definitely appreciate the help finding / fixing these bugs.
Cheers, Russ
comment:4 Changed 12 years ago by
Note: See
TracTickets for help on using
tickets.
I don't know anything about this change, but I would just add that a more common pattern I see in the Trac codebase is:
... so I would assume that is the more Pythonic way to do a comparison.