You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
enable_fts() exhausts iterator columns before populating the index #902
Table.enable_fts() accepts columns: Iterable[str], but passing a one-shot iterator raises sqlite3.OperationalError: near ")": syntax error. The same columns supplied as a list work. The FTS virtual table has already been created when the error occurs, so a retry without replace=True also encounters an existing table.
Reproduced locally against main 9c66bafa52ae23d40499c74b0db3b635bcddb876, Python 3.12.14, using an in-memory database:
fromsqlite_utilsimportDatabasedb=Database(memory=True)
table=db["notes"].insert({"text": "hello"})
table.enable_fts(iter(["text"]))
# sqlite3.OperationalError: near ")": syntax error
Replacing iter(["text"]) with ["text"] succeeds and list(table.search("hello")) returns the record. I reproduced the failure with both FTS4 and FTS5, with and without create_triggers=True.
The iterable is consumed while building CREATE VIRTUAL TABLE, then passed to populate_fts(). Trigger construction also reuses it. Materializing the columns once would preserve the declared iterable contract.
AI assistance: OpenAI Codex inspected the code and ran this reproduction. No live service, user database, or external model call was used.
Activity