@@ -13,7 +13,7 @@ import Foundation
1313/// The virtual table module for the FTS5 full-text engine.
1414///
1515/// To create FTS5 tables, use the ``Database`` method
16- /// ``Database/create(virtualTable:ifNotExists :using:_:)``:
16+ /// ``Database/create(virtualTable:options :using:_:)``:
1717///
1818/// ```swift
1919/// // CREATE VIRTUAL TABLE document USING fts5(content)
@@ -85,7 +85,7 @@ public struct FTS5 {
8585 /// }
8686 /// ```
8787 ///
88- /// See ``Database/create(virtualTable:ifNotExists :using:_:)``
88+ /// See ``Database/create(virtualTable:options :using:_:)``
8989 public init ( ) { }
9090
9191 // Support for FTS5Pattern initializers. Don't make public. Users tokenize
@@ -143,7 +143,7 @@ extension FTS5: VirtualTableModule {
143143
144144 /// Reserved; part of the VirtualTableModule protocol.
145145 ///
146- /// See Database.create(virtualTable:using:)
146+ /// See Database.create(virtualTable:options: using:_ :)
147147 public func makeTableDefinition( configuration: VirtualTableConfiguration ) -> FTS5TableDefinition {
148148 FTS5TableDefinition ( configuration: configuration)
149149 }
@@ -219,14 +219,24 @@ extension FTS5: VirtualTableModule {
219219
220220 /// Reserved; part of the VirtualTableModule protocol.
221221 ///
222- /// See Database.create(virtualTable:using:)
222+ /// See Database.create(virtualTable:options: using:_ :)
223223 public func database( _ db: Database , didCreate tableName: String , using definition: FTS5TableDefinition ) throws {
224224 switch definition. contentMode {
225225 case . raw:
226226 break
227227 case . synchronized( let contentTable) :
228228 // https://sqlite.org/fts5.html#external_content_tables
229229
230+ if definition. configuration. temporary {
231+ // SQLite can't rebuild the index of temporary tables:
232+ //
233+ // sqlite> CREATE TABLE t(id INTEGER PRIMARY KEY, a, b, c);
234+ // sqlite> CREATE VIRTUAL TABLE temp.ft USING fts5(content="t",content_rowid="a",b,c);
235+ // sqlite> INSERT INTO ft(ft) VALUES('rebuild');
236+ // Runtime error: SQL logic error
237+ fatalError ( " Temporary external content FTS5 tables are not supported. " )
238+ }
239+
230240 let rowIDColumn = try db. primaryKey ( contentTable) . rowIDColumn ?? Column . rowID. name
231241 let ftsTable = tableName. quotedDatabaseIdentifier
232242 let content = contentTable. quotedDatabaseIdentifier
@@ -274,7 +284,7 @@ extension FTS5: VirtualTableModule {
274284/// virtual table.
275285///
276286/// You don't create instances of this class. Instead, you use the `Database`
277- /// ``Database/create(virtualTable:ifNotExists :using:_:)`` method:
287+ /// ``Database/create(virtualTable:options :using:_:)`` method:
278288///
279289/// ```swift
280290/// try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
0 commit comments