Modify ↓
Opened 16 years ago
Closed 16 years ago
#6378 closed defect (duplicate)
[patch] Cannot view tickets with MasterTickets plugin installed when using postgres
| Reported by: | Owned by: | Noah Kantrowitz | |
|---|---|---|---|
| Priority: | normal | Component: | MasterTicketsPlugin |
| Severity: | critical | Keywords: | Postgres |
| Cc: | theyranos@… | Trac Release: | 0.11 |
Description
I get this traceback when trying to view a ticket with MasterTicket plugin installed using postgres 8.4 as db backend.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/web/api.py", line 339, in send_error
'text/html')
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/web/chrome.py", line 699, in render_template
stream |= self._filter_stream(req, method, filename, stream, data)
File "build/bdist.linux-x86_64/egg/genshi/core.py", line 128, in __or__
return Stream(_ensure(function(self)), serializer=self.serializer)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/web/chrome.py", line 802, in inner
data)
File "build/bdist.linux-x86_64/egg/ticketguidelines/web_ui.py", line 190, in filter_stream
stream = stream | Transformer('//form[@id="propertyform"]/h3[1]').after(_get_wiki_html(self.env, data, False))
File "build/bdist.linux-x86_64/egg/ticketguidelines/web_ui.py", line 66, in _get_wiki_html
page = WikiPage(env, wiki_page)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/wiki/model.py", line 43, in __init__
self._fetch(name, version, db)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/wiki/model.py", line 64, in _fetch
(name,))
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/db/util.py", line 50, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/local/lib/python2.6/dist-packages/Trac-0.11-py2.6.egg/trac/db/util.py", line 50, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
InternalError: current transaction is aborted, commands ignored until end of transaction block
I trace the error and it is a implict cast that postgres does not allow in this lines:
cursor = db.cursor() cursor.execute('SELECT dest FROM mastertickets WHERE source=%s ORDER BY dest', (self.tkt.id,)) self.blocking = set([num for num, in cursor]) self._old_blocking = copy.copy(self.blocking) cursor.execute('SELECT source FROM mastertickets WHERE dest=%s ORDER BY source', (self.tkt.id,)) self.blocked_by = set([num for num, in cursor])
I fix it with this patch:
-
mastertickets/model.py
19 19 db = db or self.env.get_db_cnx() 20 20 cursor = db.cursor() 21 21 22 cursor.execute( 'SELECT dest FROM mastertickets WHERE source=%s ORDER BY dest', (self.tkt.id,))22 cursor.execute("SELECT dest FROM mastertickets WHERE source='%s' ORDER BY dest", (self.tkt.id,)) 23 23 self.blocking = set([num for num, in cursor]) 24 24 self._old_blocking = copy.copy(self.blocking) 25 25 26 cursor.execute( 'SELECT source FROM mastertickets WHERE dest=%s ORDER BY source', (self.tkt.id,))26 cursor.execute("SELECT source FROM mastertickets WHERE dest='%s' ORDER BY source", (self.tkt.id,)) 27 27 self.blocked_by = set([num for num, in cursor]) 28 28 self._old_blocked_by = copy.copy(self.blocked_by)
Attachments (0)
Change History (3)
comment:1 Changed 16 years ago by
| Summary: | Cannot view tickets with MasterTickets plugin installed when using postgres → [patch] Cannot view tickets with MasterTickets plugin installed when using postgres |
|---|
comment:2 Changed 16 years ago by
| Cc: | theyranos@… added; anonymous removed |
|---|
comment:3 Changed 16 years ago by
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
This is a duplicate of #2658
Note: See
TracTickets for help on using
tickets.



Here's a (potentially) better patch for this ticket, which sets the types in the database correctly in the first place when you run trac-admin . upgrade
=================================================================== --- 0.11/mastertickets/db_default.py (revision 7381) +++ 0.11/mastertickets/db_default.py (working copy) @@ -7,7 +7,7 @@ version = 1 tables = [ Table('mastertickets', key=('source','dest'))[ - Column('source'), - Column('dest'), + Column('source', type='integer'), + Column('dest', type='integer'), ], -] \ No newline at end of file +]