Skip to content

Commit 3e84537

Browse files
committed
fix: diagnose/report use of SQLite without FTS5 support
As of 2.2.0 Roundup requires FTS5 support in SQLite. FTS5 has been part of the main SQLite distribution since October 2015. Tonu Mikk found this when trying to run 2.3.0 under RedHat 7. He got a traceback when trying to spin up 2.3.0. It took us a bit to figure out that FTS5 was missing from the SQLite library used by Python3. See: https://sourceforge.net/p/roundup/mailman/message/51783129/ This change catches the sql error and checks to see if the ENABLE_FTS5 compile option is defined. If not it raises NotImplementedError with a more useful error message and reports the version of SQLite in use. This will at least ease diagnosis. Trying to support SQLite without FTS5 support raises a number of issues including tracking the internal schema used by Roundup. So not going to attempt that. Details: https://sourceforge.net/p/roundup/mailman/message/51783321/
1 parent 27646f5 commit 3e84537

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CHANGES.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Fixed:
7171
newer. dicttoxml uses a type alias: collection.Iterator that is
7272
dropped in Python 3.10. (found by Norbert Schlemmer, fix John
7373
Rouillard)
74-
- fix repeated password id with user.item.html in all templates except
74+
- fix duplicate html id 'password' in user.item.html in all templates except
7575
jinja2. (John Rouillard)
7676
- fix unclosed file when saving index in indexer_dbm.py. (John Rouillard)
7777
- fix task index in devel tracker so it doesn't cause a crash if all
@@ -83,6 +83,10 @@ Fixed:
8383
John Rouillard)
8484
- fix roundup-demo, interactive mode would nuke an existing tracker.
8585
(Found Tonu Mikk, fix John Rouillard)
86+
- fix detection/reporting when using a SQLite3 library without FTS5
87+
support. Install docs updated to state that FTS5 support is required
88+
when using SQLite for back end. (Found Tonu Mikk, fix John
89+
Rouillard)
8690

8791
Features:
8892

roundup/backends/back_sqlite.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,21 @@ def fix_version_3_tables(self):
252252
pass
253253

254254
def _add_fts5_table(self):
255-
self.sql('CREATE virtual TABLE __fts USING fts5(_class, '
255+
try:
256+
self.sql('CREATE virtual TABLE __fts USING fts5(_class, '
256257
'_itemid, _prop, _textblob)')
258+
except sqlite.OperationalError:
259+
available_options = self.cursor.execute(
260+
'pragma compile_options;').fetchall()
261+
if 'ENABLE_FTS5' in [opt['compile_options'] for opt
262+
in available_options]:
263+
# sqlite supports FTS5 something else has gone wrong
264+
raise
265+
else:
266+
# report a useful error message
267+
raise NotImplementedError(
268+
"This version of SQLite was not built with support "
269+
"for FTS5. SQLite version: %s" % sqlite.sqlite_version)
257270

258271
def fix_version_6_tables(self):
259272
# note sqlite has no limit on column size so v6 fixes

0 commit comments

Comments
 (0)