summaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2013-07-18 17:10:16 -0400
committerStephen Frost <sfrost@snowman.net>2013-07-18 17:10:16 -0400
commit4cbe3ac3e86790d05c569de4585e5075a62a9b41 (patch)
tree8adc929520d4103b4493c0c23bcb7d2b2c2a5a4d /src/backend/nodes/outfuncs.c
parent6f9e39bc9993c18686f0950f9b9657c7c97c7450 (diff)
downloadpostgresql-4cbe3ac3e86790d05c569de4585e5075a62a9b41.tar.gz
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/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 2475f8d520..48cd9dcb8d 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -332,6 +332,7 @@ _outModifyTable(StringInfo str, const ModifyTable *node)
WRITE_NODE_FIELD(resultRelations);
WRITE_INT_FIELD(resultRelIndex);
WRITE_NODE_FIELD(plans);
+ WRITE_NODE_FIELD(withCheckOptionLists);
WRITE_NODE_FIELD(returningLists);
WRITE_NODE_FIELD(fdwPrivLists);
WRITE_NODE_FIELD(rowMarks);
@@ -2247,6 +2248,7 @@ _outQuery(StringInfo str, const Query *node)
WRITE_NODE_FIELD(rtable);
WRITE_NODE_FIELD(jointree);
WRITE_NODE_FIELD(targetList);
+ WRITE_NODE_FIELD(withCheckOptions);
WRITE_NODE_FIELD(returningList);
WRITE_NODE_FIELD(groupClause);
WRITE_NODE_FIELD(havingQual);
@@ -2261,6 +2263,16 @@ _outQuery(StringInfo str, const Query *node)
}
static void
+_outWithCheckOption(StringInfo str, const WithCheckOption *node)
+{
+ WRITE_NODE_TYPE("WITHCHECKOPTION");
+
+ WRITE_STRING_FIELD(viewname);
+ WRITE_NODE_FIELD(qual);
+ WRITE_BOOL_FIELD(cascaded);
+}
+
+static void
_outSortGroupClause(StringInfo str, const SortGroupClause *node)
{
WRITE_NODE_TYPE("SORTGROUPCLAUSE");
@@ -3114,6 +3126,9 @@ _outNode(StringInfo str, const void *obj)
case T_Query:
_outQuery(str, obj);
break;
+ case T_WithCheckOption:
+ _outWithCheckOption(str, obj);
+ break;
case T_SortGroupClause:
_outSortGroupClause(str, obj);
break;