Skip to content

Conversation

groue
Copy link
Owner

@groue groue commented Feb 23, 2025

This pull request fixes #1724 by allowing the creation of temporary virtual tables:

try database.create(virtualTable: "ft", options: .temporary, using: FTS5()) { t in
  ...
}

Note that temporary external-content FTS4 and FTS5 tables are not supported, and trigger a fatal error:

// fatal error: Temporary external content FTS5 tables are not supported.
try database.create(virtualTable: "documents_ft", options: .temporary, using: FTS5()) { t in
  t.synchronize(withTable: "documents")
  t.column("content")
}

This limitation comes from SQLite itself, which can't rebuild temporary indexes:

CREATE TABLE t(id INTEGER PRIMARY KEY, a, b, c);
CREATE VIRTUAL TABLE temp.ft USING fts4(content="t", b, c);
INSERT INTO ft(ft) VALUES('rebuild'); -- SQL logic error

@groue groue merged commit 9b09c53 into development Feb 23, 2025
8 checks passed
@groue groue deleted the dev/virtual-table-options branch February 23, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant