Updatable views

PostgreSQL supports the SQL standard CREATE VIEW command, which, starting from version 9.3, supports automatic UPDATE, INSERT, and DELETE commands, provided they are simple enough.

With older PostgreSQL versions or with more complex views, these operations can be simulated with suitable query rewrite rules, or more recently by INSTEAD OF triggers. Note that according to community support policies, at least until September 2017, there will be PostgreSQL versions prior to 9.3 that are still supported and do not support automatic updatable views. Therefore, if you are using version 9.3 or later, only the discussion in the Getting ready section of this recipe will be of interest; the rest is implemented automatically.

Note also that ...

Get PostgreSQL 9 Administration Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.