SQLite Forum

DROP VIEW IF EXISTS failure
Login
I suspect that your basic misconception is the belief that tables and views occupy separate namespaces. IOW that you can have a view "test", and a table "test", both, at the same time.

This is not the case. Wiews, as a kind of virtual table are in the same namespace as tables itself.

In your example you create an object named "test", which is of type "table". The `IF EXISTS` of the `DROP VIEW` finds that object, and then sqlite notes the type mismatch, view vs. table, and complains.

I hope that this explanation helps.