aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-05-06 11:57:05 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-05-06 12:00:06 -0400
commit3223b25ff737c2bf4a642c0deb7be2b30bfecc6e (patch)
tree2ec5c28f97878700312e4be25799ff22e4e9818b /src/backend/parser
parentc29866073ba3aab67d78c0d19ecdf790f36a8e1a (diff)
downloadpostgresql-3223b25ff737c2bf4a642c0deb7be2b30bfecc6e.tar.gz
postgresql-3223b25ff737c2bf4a642c0deb7be2b30bfecc6e.zip
Disallow unlogged materialized views.
The initial implementation of this feature was really unsupportable, because it's relying on the physical size of an on-disk file to carry the relation's populated/unpopulated state, which is at least a modularity violation and could have serious long-term consequences. We could say that an unlogged matview goes to empty on crash, but not everybody likes that definition, so let's just remove the feature for 9.3. We can add it back when we have a less klugy implementation. I left the grammar and tab-completion support for CREATE UNLOGGED MATERIALIZED VIEW in place, since it's harmless and allows delivering a more specific error message about the unsupported feature. I'm committing this separately to ease identification of what should be reverted when/if we are able to re-enable the feature.
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/analyze.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index fb28e471685..8f8da0523c5 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -2167,6 +2167,18 @@ transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
errmsg("materialized views may not be defined using bound parameters")));
/*
+ * For now, we disallow unlogged materialized views, because it
+ * seems like a bad idea for them to just go to empty after a crash.
+ * (If we could mark them as unpopulated, that would be better, but
+ * that requires catalog changes which crash recovery can't presently
+ * handle.)
+ */
+ if (stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("materialized views cannot be UNLOGGED")));
+
+ /*
* At runtime, we'll need a copy of the parsed-but-not-rewritten Query
* for purposes of creating the view's ON SELECT rule. We stash that
* in the IntoClause because that's where intorel_startup() can