Skip site navigation (1) Skip section navigation (2)

pgsql: Support automatically-updatable views.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support automatically-updatable views.
Date: 2012-12-08 23:27:54
Message-ID: E1ThToI-0000LZ-Df@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Support automatically-updatable views.

This patch makes "simple" views automatically updatable, without the need
to create either INSTEAD OF triggers or INSTEAD rules.  "Simple" views
are those classified as updatable according to SQL-92 rules.  The rewriter
transforms INSERT/UPDATE/DELETE commands on such views directly into an
equivalent command on the underlying table, which will generally have
noticeably better performance than is possible with either triggers or
user-written rules.  A view that has INSTEAD OF triggers or INSTEAD rules
continues to operate the same as before.

For the moment, security_barrier views are not considered simple.
Also, we do not support WITH CHECK OPTION.  These features may be
added in future.

Dean Rasheed, reviewed by Amit Kapila

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a99c42f291421572aef2b0a9360294c7d89b8bc7

Modified Files
--------------
doc/src/sgml/intro.sgml                       |    2 +-
doc/src/sgml/ref/alter_table.sgml             |    8 +-
doc/src/sgml/ref/alter_view.sgml              |    9 +-
doc/src/sgml/ref/create_rule.sgml             |   25 +-
doc/src/sgml/ref/create_view.sgml             |  125 +++-
doc/src/sgml/rules.sgml                       |   47 +-
src/backend/catalog/information_schema.sql    |   18 +-
src/backend/executor/execMain.c               |   20 +-
src/backend/rewrite/rewriteHandler.c          |  684 ++++++++++++++++-
src/backend/utils/adt/misc.c                  |   31 +
src/include/catalog/catversion.h              |    2 +-
src/include/catalog/pg_proc.h                 |    5 +
src/include/rewrite/rewriteHandler.h          |    2 +
src/include/utils/builtins.h                  |    2 +
src/test/regress/expected/triggers.out        |   14 -
src/test/regress/expected/updatable_views.out | 1069 +++++++++++++++++++++++++
src/test/regress/parallel_schedule            |    2 +-
src/test/regress/serial_schedule              |    1 +
src/test/regress/sql/triggers.sql             |    7 -
src/test/regress/sql/updatable_views.sql      |  511 ++++++++++++
20 files changed, 2491 insertions(+), 93 deletions(-)


pgsql-committers by date

Next:From: Tom LaneDate: 2012-12-09 05:08:55
Subject: pgsql: Fix assorted bugs in privileges-for-types patch.
Previous:From: Peter EisentrautDate: 2012-12-08 12:48:21
Subject: pgsql: Update iso.org page link

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group