Update messages, comments and documentation for materialized views.

All instances of the verbiage lagging the code.  Back-patch to 9.3,
where materialized views were introduced.
This commit is contained in:
Noah Misch 2013-07-05 15:25:51 -04:00
parent 269e780822
commit 02d2b694ee
15 changed files with 29 additions and 22 deletions

View File

@ -534,7 +534,7 @@
examine this information is to execute queries such as: examine this information is to execute queries such as:
<programlisting> <programlisting>
SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind = 'r'; SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind IN ('r', 'm');
SELECT datname, age(datfrozenxid) FROM pg_database; SELECT datname, age(datfrozenxid) FROM pg_database;
</programlisting> </programlisting>

View File

@ -512,8 +512,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
bool toast_delold[MaxHeapAttributeNumber]; bool toast_delold[MaxHeapAttributeNumber];
/* /*
* We should only ever be called for tuples of plain relations --- * We should only ever be called for tuples of plain relations or
* recursing on a toast rel is bad news. * materialized views --- recursing on a toast rel is bad news.
*/ */
Assert(rel->rd_rel->relkind == RELKIND_RELATION || Assert(rel->rd_rel->relkind == RELKIND_RELATION ||
rel->rd_rel->relkind == RELKIND_MATVIEW); rel->rd_rel->relkind == RELKIND_MATVIEW);

View File

@ -761,7 +761,6 @@ objectsInSchemaToOids(GrantObjectType objtype, List *nspnames)
switch (objtype) switch (objtype)
{ {
case ACL_OBJECT_RELATION: case ACL_OBJECT_RELATION:
/* Process regular tables, views and foreign tables */
objs = getRelationsInNamespace(namespaceId, RELKIND_RELATION); objs = getRelationsInNamespace(namespaceId, RELKIND_RELATION);
objects = list_concat(objects, objs); objects = list_concat(objects, objs);
objs = getRelationsInNamespace(namespaceId, RELKIND_VIEW); objs = getRelationsInNamespace(namespaceId, RELKIND_VIEW);

View File

@ -1152,9 +1152,8 @@ heap_create_with_catalog(const char *relname,
/* /*
* Decide whether to create an array type over the relation's rowtype. We * Decide whether to create an array type over the relation's rowtype. We
* do not create any array types for system catalogs (ie, those made * do not create any array types for system catalogs (ie, those made
* during initdb). We create array types for regular relations, views, * during initdb). We do not create them where the use of a relation as
* composite types and foreign tables ... but not, eg, for toast tables or * such is an implementation detail: toast tables, sequences and indexes.
* sequences.
*/ */
if (IsUnderPostmaster && (relkind == RELKIND_RELATION || if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
relkind == RELKIND_VIEW || relkind == RELKIND_VIEW ||

View File

@ -98,7 +98,7 @@ CommentObject(CommentStmt *stmt)
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE) relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table, view, composite type, or foreign table", errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
RelationGetRelationName(relation)))); RelationGetRelationName(relation))));
break; break;
default: default:

View File

@ -372,7 +372,7 @@ DefineIndex(IndexStmt *stmt,
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table", errmsg("\"%s\" is not a table or materialized view",
RelationGetRelationName(rel)))); RelationGetRelationName(rel))));
} }
@ -1834,8 +1834,8 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user)
/* /*
* Scan pg_class to build a list of the relations we need to reindex. * Scan pg_class to build a list of the relations we need to reindex.
* *
* We only consider plain relations here (toast rels will be processed * We only consider plain relations and materialized views here (toast
* indirectly by reindex_relation). * rels will be processed indirectly by reindex_relation).
*/ */
relationRelation = heap_open(RelationRelationId, AccessShareLock); relationRelation = heap_open(RelationRelationId, AccessShareLock);
scan = heap_beginscan_catalog(relationRelation, 0, NULL); scan = heap_beginscan_catalog(relationRelation, 0, NULL);

View File

@ -111,7 +111,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt)
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE) relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table, view, composite type, or foreign table", errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
RelationGetRelationName(relation)))); RelationGetRelationName(relation))));
break; break;
default: default:

View File

@ -10696,7 +10696,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
relkind != RELKIND_FOREIGN_TABLE) relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table, view, sequence, or foreign table", errmsg("\"%s\" is not a table, view, materialized view, sequence, or foreign table",
rv->relname))); rv->relname)));
ReleaseSysCache(tuple); ReleaseSysCache(tuple);

View File

@ -2820,7 +2820,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
NULL, NULL,
format_type_be(domainOid)); format_type_be(domainOid));
/* Otherwise we can ignore views, composite types, etc */ /*
* Otherwise, we can ignore relations except those with both
* storage and user-chosen column types.
*
* XXX If an index-only scan could satisfy "col::some_domain" from
* a suitable expression index, this should also check expression
* index columns.
*/
if (rel->rd_rel->relkind != RELKIND_RELATION && if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_MATVIEW) rel->rd_rel->relkind != RELKIND_MATVIEW)
{ {

View File

@ -742,8 +742,8 @@ vac_update_datfrozenxid(void)
Form_pg_class classForm = (Form_pg_class) GETSTRUCT(classTup); Form_pg_class classForm = (Form_pg_class) GETSTRUCT(classTup);
/* /*
* Only consider heap and TOAST tables (anything else should have * Only consider relations able to hold unfrozen XIDs (anything else
* InvalidTransactionId in relfrozenxid anyway.) * should have InvalidTransactionId in relfrozenxid anyway.)
*/ */
if (classForm->relkind != RELKIND_RELATION && if (classForm->relkind != RELKIND_RELATION &&
classForm->relkind != RELKIND_MATVIEW && classForm->relkind != RELKIND_MATVIEW &&
@ -1044,7 +1044,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
} }
/* /*
* Check that it's a vacuumable table; we used to do this in * Check that it's a vacuumable relation; we used to do this in
* get_rel_oids() but seems safer to check after we've locked the * get_rel_oids() but seems safer to check after we've locked the
* relation. * relation.
*/ */

View File

@ -683,7 +683,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE) relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table, view, composite type, or foreign table", errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
RelationGetRelationName(relation)))); RelationGetRelationName(relation))));
cancel_parser_errposition_callback(&pcbstate); cancel_parser_errposition_callback(&pcbstate);

View File

@ -258,6 +258,8 @@ DefineQueryRewrite(char *rulename,
/* /*
* Verify relation is of a type that rules can sensibly be applied to. * Verify relation is of a type that rules can sensibly be applied to.
* Internal callers can target materialized views, but transformRuleStmt()
* blocks them for users. Don't mention them in the error message.
*/ */
if (event_relation->rd_rel->relkind != RELKIND_RELATION && if (event_relation->rd_rel->relkind != RELKIND_RELATION &&
event_relation->rd_rel->relkind != RELKIND_MATVIEW && event_relation->rd_rel->relkind != RELKIND_MATVIEW &&

View File

@ -269,7 +269,7 @@ flagInhTables(TableInfo *tblinfo, int numTables,
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
{ {
/* Sequences and views never have parents */ /* Some kinds never have parents */
if (tblinfo[i].relkind == RELKIND_SEQUENCE || if (tblinfo[i].relkind == RELKIND_SEQUENCE ||
tblinfo[i].relkind == RELKIND_VIEW || tblinfo[i].relkind == RELKIND_VIEW ||
tblinfo[i].relkind == RELKIND_MATVIEW) tblinfo[i].relkind == RELKIND_MATVIEW)
@ -315,7 +315,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables)
int numParents; int numParents;
TableInfo **parents; TableInfo **parents;
/* Sequences and views never have parents */ /* Some kinds never have parents */
if (tbinfo->relkind == RELKIND_SEQUENCE || if (tbinfo->relkind == RELKIND_SEQUENCE ||
tbinfo->relkind == RELKIND_VIEW || tbinfo->relkind == RELKIND_VIEW ||
tbinfo->relkind == RELKIND_MATVIEW) tbinfo->relkind == RELKIND_MATVIEW)

View File

@ -504,7 +504,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
AccessShareLock, true); AccessShareLock, true);
if (pmrel == NULL) if (pmrel == NULL)
return; return;
/* must be table or view, else ignore */ /* sanity-check the relation kind */
if (!(pmrel->rd_rel->relkind == RELKIND_RELATION || if (!(pmrel->rd_rel->relkind == RELKIND_RELATION ||
pmrel->rd_rel->relkind == RELKIND_MATVIEW || pmrel->rd_rel->relkind == RELKIND_MATVIEW ||
pmrel->rd_rel->relkind == RELKIND_VIEW)) pmrel->rd_rel->relkind == RELKIND_VIEW))

View File

@ -221,7 +221,7 @@ NOTICE: drop cascades to table inhe
CREATE TABLE ctlt4 (a int, b text); CREATE TABLE ctlt4 (a int, b text);
CREATE SEQUENCE ctlseq1; CREATE SEQUENCE ctlseq1;
CREATE TABLE ctlt10 (LIKE ctlseq1); -- fail CREATE TABLE ctlt10 (LIKE ctlseq1); -- fail
ERROR: "ctlseq1" is not a table, view, composite type, or foreign table ERROR: "ctlseq1" is not a table, view, materialized view, composite type, or foreign table
LINE 1: CREATE TABLE ctlt10 (LIKE ctlseq1); LINE 1: CREATE TABLE ctlt10 (LIKE ctlseq1);
^ ^
CREATE VIEW ctlv1 AS SELECT * FROM ctlt4; CREATE VIEW ctlv1 AS SELECT * FROM ctlt4;