]> granicus.if.org Git - postgresql/commit
Support automatically-updatable views.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Dec 2012 23:25:48 +0000 (18:25 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Dec 2012 23:26:21 +0000 (18:26 -0500)
commita99c42f291421572aef2b0a9360294c7d89b8bc7
tree330ccf97fb7318f988d8218bb1a854bc84025d63
parentd12d9f595e1c6bc6e62b7b423762fc03ad923899
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
20 files changed:
doc/src/sgml/intro.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/alter_view.sgml
doc/src/sgml/ref/create_rule.sgml
doc/src/sgml/ref/create_view.sgml
doc/src/sgml/rules.sgml
src/backend/catalog/information_schema.sql
src/backend/executor/execMain.c
src/backend/rewrite/rewriteHandler.c
src/backend/utils/adt/misc.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/rewrite/rewriteHandler.h
src/include/utils/builtins.h
src/test/regress/expected/triggers.out
src/test/regress/expected/updatable_views.out [new file with mode: 0644]
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/triggers.sql
src/test/regress/sql/updatable_views.sql [new file with mode: 0644]