SQLite Forum

DROP TABLE failure - is it intentional or a bug?
> Is there any comment about my actual problem? Do others think that this is correct behavior?

The reason nobody is commenting is that it's hard to argue about "correct", all I can say is that it "is" the behavior.

[EDIT: Redacting all the rest of this message since it was based on an assumption that the reported error was for the reported problem, which wasn't the case, and not checking the Schema properly. Once checked properly, the real reason showed itself. See messages posted later in this thread.]

_The schema has to parse. This is checked often, but not constantly (because there is a processing cost to it). One such check is right BEFORE it's being altered._

_If you drop table "type", the schema parses just fine before that alteration._

_Once it is dropped, the schema no longer parses, because you have now broken the schema, so any next attempt will be met by the given error._

_Would it be more helpful if the schema error was evident directly after the remove table? Perhaps, but that would need another schema parse which, as I've mentioned, is expensive, so it's reasonable to choose not to do it.   
Further to this, would such an error prevent the operation from completing? Should it? What if you have two tables with cross references, A cannot be dropped because B, and B cannot be dropped because A... that's essentially the same problem but now caused by the proposed rule in stead of the current rule. I'd argue hat it's not preferred either, especially since the current "problem" can easily and simply be fixed by dropping tables in the correct order._

_Whether that is acceptable or "correct" in some sense of the word is debatable and you are welcome to take exception with it, but that is neither here nor there._

_Maybe it can be improved, and you mentioning this may actually cause someone to look at it and rethink it, even if they come to the same conclusion as before. For now though, this is *how* it works and how it was designed to work, and therefore in that sense, is *correct*._