Modify

Opened 2 years ago

Closed 2 years ago

Last modified 14 months ago

#10131 closed defect (fixed)

ProgrammingError: operator does not exist: text = integerLINE 1: DELETE FROM testcaseinplan WHERE id = 398 ^HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Reported by: eric@… Owned by: seccanj
Priority: normal Component: TestManagerForTracPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

How to Reproduce

While doing a POST operation on /wiki/TC_TT36_TT42_TT154_TC398, Trac issued an internal error.

Please let me know what other info you need to debug this... basically was just trying to delete a test case. eric@…

Request parameters:

{'__FORM_TOKEN': u'e1c5260b79502c4db55a8ea9',
 'action': u'delete',
 'page': u'TC_TT36_TT42_TT154_TC398'}

User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11

System Information

Trac 0.12.2
Babel 0.9.6 (translations unavailable)
Docutils 0.8.1
Genshi 0.6
mod_python 3.3.1
psycopg2 2.4.5
Pygments 1.4
Python 2.7.3 (default, Apr 20 2012, 23:04:22)
[GCC 4.6.3]
pytz 2011k
setuptools 0.6
Subversion 1.6.17 (r1128011)
jQuery 1.4.2

Enabled Plugins

TestManager 1.4.11
TracGenericClass 1.1.3
TracGenericWorkflow 1.0.3

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.7/dist-packages/trac/wiki/web_ui.py", line 147, in process_request
    self._do_delete(req, versioned_page)
  File "/usr/lib/python2.7/dist-packages/trac/wiki/web_ui.py", line 254, in _do_delete
    @self.env.with_transaction()
  File "/usr/lib/python2.7/dist-packages/trac/db/api.py", line 77, in transaction_wrapper
    fn(ldb)
  File "/usr/lib/python2.7/dist-packages/trac/wiki/web_ui.py", line 262, in do_delete
    page.delete(version, db)
  File "/usr/lib/python2.7/dist-packages/trac/wiki/model.py", line 114, in delete
    listener.wiki_page_deleted(self)
  File "/var/lib/trac/plugins/TestManager-1.4.11-py2.7.egg/testmanager/wiki.py", line 98, in wiki_page_deleted
    tc.delete(del_wiki_page=False)
  File "/var/lib/trac/plugins/TracGenericClass-1.1.3-py2.7.egg/tracgenericclass/model.py", line 980, in delete
    AbstractVariableFieldsObject.delete(self, db)
  File "/var/lib/trac/plugins/TracGenericClass-1.1.3-py2.7.egg/tracgenericclass/model.py", line 675, in delete
    self.post_delete(db)
  File "/var/lib/trac/plugins/TestManager-1.4.11-py2.7.egg/testmanager/model.py", line 336, in post_delete
    cursor.execute('DELETE FROM testcaseinplan WHERE id = %s' % self['id'])
  File "/usr/lib/python2.7/dist-packages/trac/db/util.py", line 66, in execute
    return self.cursor.execute(sql)
ProgrammingError: operator does not exist: text = integer
LINE 1: DELETE FROM testcaseinplan WHERE id = 398
                                            ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Attachments (1)

model.py (31.9 KB) - added by seccanj 2 years ago.
patched model.py

Download all attachments as: .zip

Change History (5)

comment:1 Changed 2 years ago by seccanj

  • Status changed from new to assigned

Hi Eric,
thanks for the detailed debug information.

I found out the problem even if I can't reproduce it, probably because sqlite is more permissive than your DB (which is it, by the way?).

The problem is that the 'id' column is defined as string, so I should have written:

cursor.execute("DELETE FROM testcaseinplan WHERE id = '%s'", self['id'])

instead I wrote:

cursor.execute("DELETE FROM testcaseinplan WHERE id = %s", self['id'])

SQLite does not complain, but it should :D

Please, find in attachment a patched model.py file, to be replaced into:
testman4trac.1.4.11/testman4trac/trunk/testmanager/model.py

Let me know if this works and in case please close the ticket.

Ciao,
Roberto

Changed 2 years ago by seccanj

patched model.py

comment:2 Changed 2 years ago by seccanj

To download the file, use this link: model.py

Last edited 14 months ago by rjollos (previous) (diff)

comment:3 Changed 2 years ago by eric@…

  • Resolution set to fixed
  • Status changed from assigned to closed

Hi Roberto. I use PostgreSQL with Trac. I used the new model.py and it seems to now work when I delete a test case and a test catalog. Thanks!

comment:4 Changed 2 years ago by seccanj

Fixed with 1.5.1.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.