Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#6776 closed defect (fixed)

text = integer in view ticket on PostgreSQL 8.3 final

Reported by: yanick@… Owned by: John Hampton
Priority: high Milestone: 0.11
Component: ticket system Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

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 (1)

pg_str_cast.patch (1.2 KB ) - added by John Hampton 16 years ago.
Patch for correcting implicit string casts.

Download all attachments as: .zip

Change History (6)

comment:1 by yanick@…, 16 years ago

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)))

comment:2 by John Hampton, 16 years ago

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,

by John Hampton, 16 years ago

Attachment: pg_str_cast.patch added

Patch for correcting implicit string casts.

comment:3 by John Hampton, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in [6512]

comment:4 by Christian Boos, 16 years ago

Keywords: fixowner added

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

comment:5 by Christian Boos, 15 years ago

Keywords: fixowner removed
Owner: changed from Jonas Borgström to John Hampton

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from John Hampton to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.