aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/tablecmds.c3
-rw-r--r--src/backend/commands/view.c14
2 files changed, 15 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 5789a39ba3d..e76ce2ceb13 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -995,7 +995,7 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* To fire triggers, we'll need an EState as well as a ResultRelInfo for
- * each relation.
+ * each relation. We don't need to call ExecOpenIndices, though.
*/
estate = CreateExecutorState();
resultRelInfos = (ResultRelInfo *)
@@ -1008,7 +1008,6 @@ ExecuteTruncate(TruncateStmt *stmt)
InitResultRelInfo(resultRelInfo,
rel,
0, /* dummy rangetable index */
- CMD_DELETE, /* don't need any index info */
0);
resultRelInfo++;
}
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 1f418e907ea..5576ea259f4 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -419,6 +419,20 @@ DefineView(ViewStmt *stmt, const char *queryString)
elog(ERROR, "unexpected parse analysis result");
/*
+ * Check for unsupported cases. These tests are redundant with ones in
+ * DefineQueryRewrite(), but that function will complain about a bogus
+ * ON SELECT rule, and we'd rather the message complain about a view.
+ */
+ if (viewParse->intoClause != NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("views must not contain SELECT INTO")));
+ if (viewParse->hasModifyingCTE)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("views must not contain data-modifying statements in WITH")));
+
+ /*
* If a list of column names was given, run through and insert these into
* the actual query tree. - thomas 2000-03-08
*/