Skip to content

enable_fts(): accept a one-shot iterator for columns - #903

Open
syahra712 wants to merge 1 commit into
simonw:mainfrom
syahra712:fix/enable-fts-iterator-columns
Open

syahra712 wants to merge 1 commit into
simonw:mainfrom
syahra712:fix/enable-fts-iterator-columns

Conversation

@syahra712

@syahra712 syahra712 commented Oct 11, 2026 •

Copy link
Copy Markdown

Fixes #902.

enable_fts() declares columns: Iterable[str] but walks it up to five times (the CREATE VIRTUAL TABLE statement, populate_fts(), and three times for the triggers). With a generator or iter([...]) only the first pass sees any columns, so the FTS table gets created and then populate_fts() fails with near ")": syntax error, leaving an empty _fts table behind.

This turns columns into a list once at the top of the method.

The new test passes iter(["text", "country"]) with and without create_triggers; both cases fail on main and pass here. tests/test_fts.py is green and black --check is clean.


📚 Documentation preview 📚: https://sqlite-utils--903.org.readthedocs.build/en/903/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enable_fts() exhausts iterator columns before populating the index

1 participant