Modify

Opened 16 years ago

Last modified 12 years ago

#4214 new defect

Downloader broken on postgres 8.3 - integer to string cast

Reported by: jen@… Owned by: Petr Škoda
Priority: high Component: TracDownloaderPlugin
Severity: normal Keywords: postgres 8.3
Cc: Trac Release: 0.11

Description

The downloader seems to be broken on trac instances run w/ postgres as the backend. I have experienced the following issues:

 Trac detected an internal error:

OperationalError: ERROR:  operator does not exist: text = integer
LINE 1: SELECT id FROM downloader_release WHERE category=2 AND delet...
                                                        ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 423, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 197, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/trac/admin/web_ui.py", line 118, in process_request
  path_info)
File "build/bdist.linux-x86_64/egg/tracdownloader/admin.py", line 141, in process_admin_request
 File "build/bdist.linux-x86_64/egg/tracdownloader/admin.py", line 186, in _serve_files_admin
File "build/bdist.linux-x86_64/egg/tracdownloader/model.py", line 133, in render_downloads_table
File "build/bdist.linux-x86_64/egg/tracdownloader/model.py", line 377, in get_releases
File "/usr/lib/python2.5/site-packages/trac/db/util.py", line 50, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.5/site-packages/trac/db/util.py", line 50, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py", line 3111, in execute
  raise OperationalError, msg

The problem is that the category column in downloader_release table has an incorrect type. Maybe, it should be fixed globally and column datatype should be changed to 'integer'. The same issue occurs when accessing the downloader_file table on release column.

I am attaching a temporary fix that explicitely converts the id's used in select to strings, so that the value gets enclosed into quotes when generating the sql query. Postgres won't do any implicit casts anymore.

Thanks,

Jan

Attachments (1)

sql-fixes2 (1.0 KB) - added by jen@… 16 years ago.
A temporary workaround for trac running on postgres 8.3. Explicit conversion of integer to string so that the value matches its column type.

Download all attachments as: .zip

Change History (1)

Changed 16 years ago by jen@…

Attachment: sql-fixes2 added

A temporary workaround for trac running on postgres 8.3. Explicit conversion of integer to string so that the value matches its column type.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Petr Škoda.

Add Comment


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

 
Note: See TracTickets for help on using tickets.