diff options
author | Stephen Frost <sfrost@snowman.net> | 2013-07-18 17:10:16 -0400 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2013-07-18 17:10:16 -0400 |
commit | 4cbe3ac3e86790d05c569de4585e5075a62a9b41 (patch) | |
tree | 8adc929520d4103b4493c0c23bcb7d2b2c2a5a4d /src/backend/access/common | |
parent | 6f9e39bc9993c18686f0950f9b9657c7c97c7450 (diff) | |
download | postgresql-4cbe3ac3e86790d05c569de4585e5075a62a9b41.tar.gz postgresql-4cbe3ac3e86790d05c569de4585e5075a62a9b41.zip |
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
Diffstat (limited to 'src/backend/access/common')
-rw-r--r-- | src/backend/access/common/reloptions.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index c439702a011..b5fd30a4f95 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -24,6 +24,7 @@ #include "catalog/pg_type.h" #include "commands/defrem.h" #include "commands/tablespace.h" +#include "commands/view.h" #include "nodes/makefuncs.h" #include "utils/array.h" #include "utils/attoptcache.h" @@ -248,6 +249,17 @@ static relopt_string stringRelOpts[] = gistValidateBufferingOption, "auto" }, + { + { + "check_option", + "View has WITH CHECK OPTION defined (local or cascaded).", + RELOPT_KIND_VIEW + }, + 0, + true, + validateWithCheckOption, + NULL + }, /* list terminator */ {{NULL}} }; @@ -1152,6 +1164,8 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind) offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)}, {"security_barrier", RELOPT_TYPE_BOOL, offsetof(StdRdOptions, security_barrier)}, + {"check_option", RELOPT_TYPE_STRING, + offsetof(StdRdOptions, check_option_offset)}, }; options = parseRelOptions(reloptions, validate, kind, &numoptions); |