WITH CHECK OPTION support for auto-updatable VIEWs

Stephen Frost <sfrost@snowman.net>

Commit: 4cbe3ac3e86790d05c569de4585e5075a62a9b41
Author: Stephen Frost <sfrost@snowman.net>
Date: 2013-07-18T21:10:16Z
Releases: 9.4.0
WITH CHECK OPTION support for auto-updatable VIEWs

For simple views which are automatically updatable, this patch allows
the user to specify what level of checking should be done on records
being inserted or updated.  For 'LOCAL CHECK', new tuples are validated
against the conditionals of the view they are being inserted into, while
for 'CASCADED CHECK' the new tuples are validated against the
conditionals for all views involved (from the top down).

This option is part of the SQL specification.

Dean Rasheed, reviewed by Pavel Stehule

Files

PathChange+/−
doc/src/sgml/ref/alter_view.sgml modified +5 −0
doc/src/sgml/ref/create_view.sgml modified +140 −59
src/backend/access/common/reloptions.c modified +14 −0
src/backend/catalog/information_schema.sql modified +7 −1
src/backend/catalog/sql_features.txt modified +2 −2
src/backend/commands/tablecmds.c modified +36 −0
src/backend/commands/view.c modified +68 −0
src/backend/executor/execMain.c modified +43 −0
src/backend/executor/nodeModifyTable.c modified +33 −0
src/backend/nodes/copyfuncs.c modified +18 −0
src/backend/nodes/equalfuncs.c modified +15 −0
src/backend/nodes/nodeFuncs.c modified +14 −0
src/backend/nodes/outfuncs.c modified +15 −0
src/backend/nodes/readfuncs.c modified +18 −0
src/backend/optimizer/plan/createplan.c modified +9 −6
src/backend/optimizer/plan/planner.c modified +28 −2
src/backend/parser/gram.y modified +21 −22
src/backend/rewrite/rewriteHandler.c modified +107 −10
src/bin/pg_dump/pg_dump.c modified +14 −2
src/bin/pg_dump/pg_dump.h modified +1 −0
src/include/catalog/catversion.h modified +1 −1
src/include/commands/view.h modified +2 −0
src/include/executor/executor.h modified +2 −0
src/include/nodes/execnodes.h modified +4 −0
src/include/nodes/nodes.h modified +1 −0
src/include/nodes/parsenodes.h modified +23 −0
src/include/nodes/plannodes.h modified +1 −0
src/include/optimizer/planmain.h modified +2 −1
src/include/rewrite/rewriteHandler.h modified +4 −0
src/include/utils/rel.h modified +34 −0
src/test/regress/expected/create_view.out modified +1 −1
src/test/regress/expected/updatable_views.out modified +363 −0
src/test/regress/sql/updatable_views.sql modified +199 −0