开发者

SQLite create pre-populated FTS table

开发者 https://www.devze.com 2023-04-05 19:14 出处:网络
Is there a way to create an FTS table in SQLite that is pre-populated with data from a SELECT query? I know it’s possible to create a regular table that is prepopulated with data from a SELECT:

Is there a way to create an FTS table in SQLite that is pre-populated with data from a SELECT query?

I know it’s possible to create a regular table that is prepopulated with data from a SELECT: CREATE TABLE foo AS SELECT ref_id, name FROM other_table

And we 开发者_如何转开发can create an FTS table like so: CREATE VIRTUAL TABLE bar USING FTS3(ref_id, name)

The point of doing this is to update my app’s SQLite database schema while avoiding reading in all of the data from other_table. I’m really hoping there’s some way to let SQLite do all the heavy lifting here (which is what it's really good at!).


I'm not sure if you can do it in one statement, but you can do it in two... after your CREATE VIRTUAL TABLE statement, you can do: INSERT INTO bar SELECT * FROM other_table

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号