SQLite Forum

'Automatically' update R-Tree table
Login

'Automatically' update R-Tree table

(1) By Remco Poelstra (remcopoelstra) on 2020-07-07 11:08:09 [link] [source]

Hi,

I'm using an R-Tree table in companion with a (rather large) table that contains all other data. Sometimes rows are deleted from the companion table due to foreign key constraints. Unfortunately the data in the R-Tree table remains untouched.

It seems that R-Tree tables do not support foreign keys. Is there perhaps another way that I can make sure that rows are deleted from the R-Tree table in response to deletes from the companion table?

Thanks in advance.

Kind regards,

Remco Poelstra

(2) By Richard Damon (RichardDamon) on 2020-07-07 12:02:00 in reply to 1 [link] [source]

Perhaps you could set up a trigger to update the R-Tree when the companion table is updated.

(3) By Remco Poelstra (remcopoelstra) on 2020-07-07 13:04:23 in reply to 2 [source]

Thanks for the tip! This seems to work fine indeed.

Kind regards,

Remco Poelstra