top | item 32895976

(no title)

kigiri | 3 years ago

This use allow to update SELECT operations, but UPDATE / DELETE still have to be done on the old underlying schema right ?

No way to trigger a DELETE from a view right ? How would you approach this ?

discuss

order

brigandish|3 years ago

Views can be updatable though there are caveats, but deletes and updats can be done via a function or stored procedure, meaning there's no direct access by the app to the underlying schema. If it's done well it means that the calling code in the app won't have to change (or at least be minimised) even as the schema changes. The speed and security benefits are a nice by-product.

You can even do things like prevent the app from deleting things unless the functions are used and prevent poor development practices in the process.