Table names being dropped that are used in the body of a view or trigger that is not ON that table should act to prohibit the table from being dropped unless the user has indicated that they wish to allow an inconsistent schema result (pragma legacy_alter_table).Ĭolumn names being dropped that are referenced in a view or trigger body (or in an index) should also cause the drop of the column name to fail with an error rather than leaving the schema in an inconsistent state UNLESS one has specifically enabled the option for allowing an inconsistent schema (pragma legacy_alter_table). If you drop a table then all triggers which apply to that table (as in specified in the ON clause) should be dropped because they are entirely no longer applicable. To me that is like asking the user to manually delete triggers before dropping a table. The use of a DDL command should not result in an invalid schema unless you have specified that this is the result you intend. But then neither should the DROP COLUMN command fail before the surrounding transaction commits.ĭo you have a rationale for why you prefer fail to drop? In that case an immediate dropping of related views and triggers would not be so useful. It would possibly be annoying to have to recreate all views and triggers here. Similarly, perhaps one could imagine wanting to change a column type, leaving the rest of the schema alone: BEGIN Ideally that would only be allowed inside a transaction and rejected at COMMIT time unless resolved by additional DDL statements. There is however at least one situation today where DDL does result in an inconsistent schema: the first table of a circular foreign key reference. Why make them jump through the extra hoops? To me that is like asking the user to manually delete triggers before dropping a table. Do you have a rationale for why you prefer fail to drop? If the user intends to drop a column and SQLite says you can't because of x,y and z, then the user has to manually do that work anyway.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |