On 22/03/2017 11:33, 邱朗 wrote:
Hi,


Is there any way to drop view “automatically” when its associated table is 
dropped?
It seems no way to do. Then if I drop a table, is there any (easy) way to find 
views created based on it and I can drop view manually ?

A quick and dirty procedure:

sqlite> create table T(A,B,C);
sqlite> create view TA as select A,B from T;
sqlite> create view TB as select B,C from T;
sqlite> create view TAB as select A,B,C from TA natural join TB;
sqlite> select * from TAB;
sqlite> drop table T;
sqlite> select * from TAB;
Error: no such table: main.T

Also works for "drop view". Quite easy to code in any host language like other exceptions.

J-L Hainaut
https://projects.info.unamur.be/~dbm/mediawiki/index.php/Accueil <https://projects.info.unamur.be/%7Edbm/mediawiki/index.php/Accueil>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to