O'Reilly logo

PostgreSQL 9 Administration Cookbook by Hannu Krosing, Simon Riggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making views updateable

PostgreSQL supports the SQL Standard command CREATE VIEW, though the views it creates are not automatically updateable. This could change in later releases, but at 9.0, that difficulty still exists for the administrator to overcome. We discuss those issues here.

Getting ready

First, you need to consider that only simple views can be made to receive inserts, updates, and deletes easily. The SQL Standard differentiates between views that are "simple updateable" and more complex views that could not be expected to be updateable.

So before we proceed, we need to check the understanding of what is a simply updateable view and what is not. Starting from the cust table as follows:

postgres=# SELECT * FROM cust; customerid | firstname ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required