Hi all, I have a setup with two databases that have tables which refer to each other. I'd like to create triggers to handle cleanup when items are deleted from one database that are referred to from the second database. My attempts at doing this have all failed, either with SQL parse errors or with runtime errors from the triggers. For example:
sqlite> CREATE TABLE data (id INTEGER PRIMARY KEY, data TEXT); sqlite> ATTACH DATABASE '/tmp/temp.db' AS temp_db; sqlite> CREATE TABLE temp_db.status (data_id INTEGER REFERENCES data(id)); sqlite> CREATE TRIGGER cleanup AFTER DELETE ON data ...> BEGIN ...> DELETE FROM temp_db.status WHERE data_id = OLD.id; ...> END; SQL error: near ".": syntax error Then I tried: sqlite> CREATE TRIGGER cleanup AFTER DELETE ON data ...> BEGIN ...> DELETE FROM status WHERE data_id = OLD.id; ...> END; which was allowed, but when deleting an item from data I get: sqlite> DELETE FROM data WHERE id=1; SQL error: no such table: main.status Any ideas on how to do the cleanup across attached databases? -Jeff _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users