Edgewall Software

Ticket #6776 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

text = integer in view ticket on PostgreSQL 8.3 final

Reported by: yanick@… Owned by: jonas
Priority: high Milestone: 0.11
Component: ticket system Version: devel
Severity: normal Keywords: fixowner
Cc:

Description

Traceback (most recent call last):
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\api.py", line 339, in send_error
    'text/html')
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\chrome.py", line 670, in render_template
    if not req.session or not int(req.session.get('accesskeys', 0)):
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\api.py", line 168, in __getattr__
    value = self.callbacks[name](self)
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\main.py", line 255, in _get_session
    return Session(self.env, req)
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\session.py", line 53, in __init__
    self.get_session(req.authname, authenticated=True)
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\web\session.py", line 74, in get_session
    (sid, int(authenticated)))
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\db\util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "c:\work\python25\lib\site-packages\Trac-0.11b1-py2.5.egg\trac\db\util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
ProgrammingError: current transaction is aborted, commands ignored until end of transaction block

From log:

2008-02-06 12:54:30,703 Trac[main] ERROR: operator does not exist: text = integer
LINE 1: ...mment',null,description,0 FROM attachment WHERE id=17 ORDER ...
                                                             ^
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 "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\web\main.py", line 406, in _dispatch_request
    dispatcher.dispatch(req)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\web\main.py", line 195, in dispatch
    resp = chosen_handler.process_request(req)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\web_ui.py", line 159, in process_request
    return self._process_ticket_request(req)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\web_ui.py", line 482, in _process_ticket_request
    get_reporter_id(req, 'author'), field_changes)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\web_ui.py", line 1104, in _insert_ticket_data
    for change in self.rendered_changelog_entries(req, ticket):
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\web_ui.py", line 1202, in rendered_changelog_entries
    for group in self.grouped_changelog_entries(ticket, None, when):
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\web_ui.py", line 1269, in grouped_changelog_entries
    changelog = ticket.get_changelog(when=when, db=db)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\ticket\model.py", line 310, in get_changelog
    "ORDER BY time", (self.id,  str(self.id), self.id))
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\db\util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "c:\work\python25\lib\site-packages\Trac-0.11dev_r6486-py2.5.egg\trac\db\util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
ProgrammingError: operator does not exist: text = integer
LINE 1: ...mment',null,description,0 FROM attachment WHERE id=17 ORDER ...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

I think, it is same error as #6274

Attachments

pg_str_cast.patch (1.2 KB) - added by jhampton 10 months ago.
Patch for correcting implicit string casts.

Change History

Changed 10 months ago by yanick@…

Fixed by add str() -> file ticket/model.py (from line 290):

        if when_ts:
            cursor.execute("SELECT time,author,field,oldvalue,newvalue,1 "
                           "FROM ticket_change WHERE ticket=%s AND time=%s "
                           "UNION "
                           "SELECT time,author,'attachment',null,filename,0 "
                           "FROM attachment WHERE id=%s AND time=%s "
                           "UNION "
                           "SELECT time,author,'comment',null,description,0 "
                           "FROM attachment WHERE id=%s AND time=%s "
                           "ORDER BY time",
                           (self.id, when_ts, str(self.id), when_ts, str(self.id), when_ts))
        else:
            cursor.execute("SELECT time,author,field,oldvalue,newvalue,1 "
                           "FROM ticket_change WHERE ticket=%s "
                           "UNION "
                           "SELECT time,author,'attachment',null,filename,0 "
                           "FROM attachment WHERE id=%s "
                           "UNION "
                           "SELECT time,author,'comment',null,description,0 "
                           "FROM attachment WHERE id=%s "
                           "ORDER BY time", (self.id,  str(self.id), str(self.id)))

Changed 10 months ago by jhampton

attached is the patch.

  • model.py

     
    297297                           "SELECT time,author,'comment',null,description,0 " 
    298298                           "FROM attachment WHERE id=%s AND time=%s " 
    299299                           "ORDER BY time", 
    300                            (self.id, when_ts, str(self.id), when_ts, self.id, when_ts)) 
     300                           (self.id, when_ts, str(self.id), when_ts, str(self.id), when_ts)) 
    301301        else: 
    302302            cursor.execute("SELECT time,author,field,oldvalue,newvalue,1 " 
    303303                           "FROM ticket_change WHERE ticket=%s " 
     
    307307                           "UNION " 
    308308                           "SELECT time,author,'comment',null,description,0 " 
    309309                           "FROM attachment WHERE id=%s " 
    310                            "ORDER BY time", (self.id,  str(self.id), self.id)) 
     310                           "ORDER BY time", (self.id,  str(self.id), str(self.id))) 
    311311        log = [] 
    312312        for t, author, field, oldvalue, newvalue, permanent in cursor: 
    313313            log.append((datetime.fromtimestamp(int(t), utc), author, field, 

Changed 10 months ago by jhampton

Patch for correcting implicit string casts.

Changed 10 months ago by jhampton

  • status changed from new to closed
  • resolution set to fixed

Fixed in [6512]

Changed 10 months ago by cboos

  • keywords fixowner added

Thanks for taking care of this one, but please don't forget to assign the ticket to yourself next time!

Add/Change #6776 (text = integer in view ticket on PostgreSQL 8.3 final)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.