SQLite Forum

> As Larry pointed out, this sounds very much like a one-time problem which has simply struck a nerve for you, not a recurring thing which is a frequent/recurring hindrance. You fix your (demonstrably incorrect) "whole stack" a single time and it's done.

I cannot do that. At the point I am trying to "DROP VIEW IF EXISTS" (no one has told me about the sense of "IF EXISTS" if I had to check for existance by myself anyway) I simply don't know whether it is a view or a table. If it's a view, it should be dropped. If it's a table, it should be kept.

The same applies to "CREATE VIEW IF NOT EXISTS" (which I haven't tested yet): It should of course do nothing if the given name doesn't exist as a *view*. Whether it doesn't exist at all or it is a table, should not matter. The current behavior is completely counterintuitive.

It's perfectly correct for "DROP VIEW / CREATE VIEW" to throw an error in this case. But the sole purpose of using "IF [NOT] EXISTS" is to skip that error.

So @everyone who thinks the behavior is correct: Please explain to me how I should drop a view if, and only if, it exists as a view and without giving an error, and with plain SQL only as it has to be carried out within a batch of SQL statements.