pgsql: WITH CHECK OPTION support for auto-updatable VIEWs

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: WITH CHECK OPTION support for auto-updatable VIEWs
Date: 2013-07-18 21:24:02
Message-ID: E1UzvgA-0007px-V8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4cbe3ac3e86790d05c569de4585e5075a62a9b41

Modified Files
--------------
doc/src/sgml/ref/alter_view.sgml | 5 +
doc/src/sgml/ref/create_view.sgml | 199 ++++++++++----
src/backend/access/common/reloptions.c | 14 +
src/backend/catalog/information_schema.sql | 8 +-
src/backend/catalog/sql_features.txt | 4 +-
src/backend/commands/tablecmds.c | 36 +++
src/backend/commands/view.c | 68 +++++
src/backend/executor/execMain.c | 43 +++
src/backend/executor/nodeModifyTable.c | 33 +++
src/backend/nodes/copyfuncs.c | 18 ++
src/backend/nodes/equalfuncs.c | 15 +
src/backend/nodes/nodeFuncs.c | 14 +
src/backend/nodes/outfuncs.c | 15 +
src/backend/nodes/readfuncs.c | 18 ++
src/backend/optimizer/plan/createplan.c | 15 +-
src/backend/optimizer/plan/planner.c | 30 +-
src/backend/parser/gram.y | 43 ++-
src/backend/rewrite/rewriteHandler.c | 117 +++++++-
src/bin/pg_dump/pg_dump.c | 16 +-
src/bin/pg_dump/pg_dump.h | 1 +
src/include/catalog/catversion.h | 2 +-
src/include/commands/view.h | 2 +
src/include/executor/executor.h | 2 +
src/include/nodes/execnodes.h | 4 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/parsenodes.h | 23 ++
src/include/nodes/plannodes.h | 1 +
src/include/optimizer/planmain.h | 3 +-
src/include/rewrite/rewriteHandler.h | 4 +
src/include/utils/rel.h | 34 +++
src/test/regress/expected/create_view.out | 2 +-
src/test/regress/expected/updatable_views.out | 363 +++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql | 199 ++++++++++++++
33 files changed, 1245 insertions(+), 107 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-07-19 01:23:47 pgsql: Fix regex match failures for backrefs combined with non-greedy q
Previous Message Fujii Masao 2013-07-18 19:13:15 pgsql: Fix typo in update scripts for some contrib modules.

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-07-18 21:27:44 Re: WITH CHECK OPTION for auto-updatable views
Previous Message Josh Berkus 2013-07-18 21:17:43 Re: Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)