SQLite Forum

DROP VIEW IF EXISTS failure
Login
MySQL has been notoriously forgiving + hand-holdy in this regard (and others - like chopping inserted varchars to size and other horrible non-errors). It plays fast-and-loose with the standard, and it works for them, it works for DB beginners or simple implementations, and one could argue that it definitely has merit. (PS - I love MySQL too)

What one shouldn't do, is hold it up as the standard by which others are measured.

You get that (and advocate for) DROPping a DB object by name should be excused if that name does not exist at all in the namespace and the programmer added "IF  EXISTS".  Here we agree.

That is however different from trying to DROP a DB object by name that DOES exist, but is not of the type you are trying to DROP (or CREATE, for that matter). The needed action in this case is to immediately notify the programmer of that mistake - and we all want to know about that mistake.

The assumption that it has Zero value is simply not true.

If the namespace was unique per object, i.e. a table and a view both named "jerry" could exist side-by-side, then you'd have a point. Since this is not possible, in any way for all Engines (or at least, the mainstream ones) your assertion that:

>Advantages of not raising an error: View can properly be dropped even if a table with same name exists.../

Is demonstrably false.

What if you said 
<code> DROP TABLE IF EXISTS jerry;</code>
while a View with the name "jerry" does exist?  Would you like the DB to simply do nothing... maybe hold its hands behind its back and whistle softly while staring into the distance like nothing happened, or would you like it to say: "Oi mate, jerry is a view, not a table."?  I have made that mistake before and am not so infallible as to be sure to never make it again, so I most certainly would like to be informed.

I get that it would be easier in the specific case you mention, but I certainly don't want the Engine to become forgiving of such a transgression when I'm the culprit doing the bad thing.

[Edit - removed silly mistaken NOT's from the text]