Edgewall Software
Modify

Ticket #2960 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Search is broken with SQLite < 3.0

Reported by: Tim Hatch <trac@…> Owned by: jonas
Priority: high Milestone: 0.10
Component: general Version: devel
Severity: major Keywords: sqlite2
Cc:

Description

I have a Debian box that's been running Trac nicely for a while, but recently encountered a search error, pointing at use of ESCAPE. Here's the traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 299, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 175, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.3/site-packages/trac/Search.py", line 184, in process_request
    results += list(source.get_search_results(req, terms, filters))
  File "/usr/lib/python2.3/site-packages/trac/ticket/api.py", line 193, in get_search_results
    args + args2)
  File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 47, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 255, in execute
    self.rs = self.con.db.execute(SQL % parms)
DatabaseError: near "ESCAPE": syntax error

This is caused by using SQLite 2.0, which works for everything else... just not for search. The relevant Debian packages are  python-sqlite (supports SQLite 2.0) and  python-pysqlite2 (which supports SQLite 3.0). I only had the first installed on this box, and the database was 2.0 format. The ESCAPE clause was  added for 3.0. After installing python-pysqlite2 and running the standard 2.0->3.0 upgrade procedure for the database, it now works great.

I believe this worked fine before r2940, as that is when ESCAPE was first added to source:trunk/trac/Search.py . The easy solution is to just upgrade any servers to pysqlite2 for SQLite 3.0.

Attachments

Change History

comment:1 Changed 4 years ago by anonymous

  • Keywords sqlite2 added
  • Priority changed from normal to high
  • Severity changed from normal to major
  • Milestone set to 0.10

#2976, #2980 marked as duplicates.

comment:2 Changed 4 years ago by cboos

#3127 marked as duplicate.

comment:3 Changed 4 years ago by cboos

... and #3133, plus I added a note on bulix.org to hopefully stop the flood of duplicate tickets.

comment:4 Changed 4 years ago by cboos

(OTOH, this ticket will make a good test case for the ticket similarity code ;) )

comment:5 Changed 4 years ago by jonas

  • Status changed from new to assigned

comment:6 Changed 4 years ago by jonas

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

Fixed in r3326.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.