]> granicus.if.org Git - postgresql/commitdiff
Update messages, comments and documentation for materialized views.
authorNoah Misch <noah@leadboat.com>
Fri, 5 Jul 2013 19:25:51 +0000 (15:25 -0400)
committerNoah Misch <noah@leadboat.com>
Fri, 5 Jul 2013 19:26:46 +0000 (15:26 -0400)
All instances of the verbiage lagging the code.  Back-patch to 9.3,
where materialized views were introduced.

15 files changed:
doc/src/sgml/maintenance.sgml
src/backend/access/heap/tuptoaster.c
src/backend/catalog/aclchk.c
src/backend/catalog/heap.c
src/backend/commands/comment.c
src/backend/commands/indexcmds.c
src/backend/commands/seclabel.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/backend/commands/vacuum.c
src/backend/parser/parse_utilcmd.c
src/backend/rewrite/rewriteDefine.c
src/bin/pg_dump/common.c
src/pl/tcl/pltcl.c
src/test/regress/expected/create_table_like.out

index c05b5262cb3436c588ed12af0f415700ac7b7b74..a3ee9c95fbe1cefbfe669e1a479367ff790392de 100644 (file)
     examine this information is to execute queries such as:
 
 <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;
 </programlisting>
 
index fc37ceb4a3ed048928050237c2a24e693e0788f6..10b9494a4e055d2ee16cbd39bc0606ed8440359f 100644 (file)
@@ -441,8 +441,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
        bool            toast_delold[MaxHeapAttributeNumber];
 
        /*
-        * We should only ever be called for tuples of plain relations ---
-        * recursing on a toast rel is bad news.
+        * We should only ever be called for tuples of plain relations or
+        * materialized views --- recursing on a toast rel is bad news.
         */
        Assert(rel->rd_rel->relkind == RELKIND_RELATION ||
                   rel->rd_rel->relkind == RELKIND_MATVIEW);
index ced66b127b9eca385f909167f460fe8afcab8c97..3a69aaf0a82c802980f16f5c801d9449d57db993 100644 (file)
@@ -761,7 +761,6 @@ objectsInSchemaToOids(GrantObjectType objtype, List *nspnames)
                switch (objtype)
                {
                        case ACL_OBJECT_RELATION:
-                               /* Process regular tables, views and foreign tables */
                                objs = getRelationsInNamespace(namespaceId, RELKIND_RELATION);
                                objects = list_concat(objects, objs);
                                objs = getRelationsInNamespace(namespaceId, RELKIND_VIEW);
index 45a84e44a1d3b75f17067ee722a17c47c65f96f1..3ee302794b13530ee7d909fa818c69bb3f058917 100644 (file)
@@ -1153,9 +1153,8 @@ heap_create_with_catalog(const char *relname,
        /*
         * 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
-        * during initdb).      We create array types for regular relations, views,
-        * composite types and foreign tables ... but not, eg, for toast tables or
-        * sequences.
+        * during initdb). We do not create them where the use of a relation as
+        * such is an implementation detail: toast tables, sequences and indexes.
         */
        if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
                                                          relkind == RELKIND_VIEW ||
index 60db27c20575c3fd2d5b706719d9c84c3d2c7038..e52a1bd2817f4ee53df7726fcfe7530513dbf6d4 100644 (file)
@@ -98,7 +98,7 @@ CommentObject(CommentStmt *stmt)
                                relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
                                ereport(ERROR,
                                                (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))));
                        break;
                default:
index 7ea90d07d3c1b85d55f93fe5f7c886335fde87d8..1ca53bad0373848608588efd6b829bfec81d2dc7 100644 (file)
@@ -372,7 +372,7 @@ DefineIndex(IndexStmt *stmt,
                else
                        ereport(ERROR,
                                        (errcode(ERRCODE_WRONG_OBJECT_TYPE),
-                                        errmsg("\"%s\" is not a table",
+                                        errmsg("\"%s\" is not a table or materialized view",
                                                        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.
         *
-        * We only consider plain relations here (toast rels will be processed
-        * indirectly by reindex_relation).
+        * We only consider plain relations and materialized views here (toast
+        * rels will be processed indirectly by reindex_relation).
         */
        relationRelation = heap_open(RelationRelationId, AccessShareLock);
        scan = heap_beginscan(relationRelation, SnapshotNow, 0, NULL);
index 3b27ac26c8e7dc72113f5299ed45dfa30f620526..e5843e6afb32a78df0d64441842d234eb10bcc13 100644 (file)
@@ -111,7 +111,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt)
                                relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
                                ereport(ERROR,
                                                (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))));
                        break;
                default:
index 8294b29b285124caac3f769641c205383b72c966..07c0816abbfa6a0480525158afc0b6fbcba3dba8 100644 (file)
@@ -10536,7 +10536,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
                relkind != RELKIND_FOREIGN_TABLE)
                ereport(ERROR,
                                (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)));
 
        ReleaseSysCache(tuple);
index 6bc16f198e3e8845df3527b8491048258fbe9c02..e5ec7c1770002aa78e8ff83fb3798cf39f5d7c28 100644 (file)
@@ -2813,7 +2813,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
                                                                                                 NULL,
                                                                                                 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 &&
                                rel->rd_rel->relkind != RELKIND_MATVIEW)
                        {
index 641c740268a8b2ec7bd502ca98375ef580d70d31..d7a7b67717a365bdbb3c42115c0bc0ed928b0a70 100644 (file)
@@ -742,8 +742,8 @@ vac_update_datfrozenxid(void)
                Form_pg_class classForm = (Form_pg_class) GETSTRUCT(classTup);
 
                /*
-                * Only consider heap and TOAST tables (anything else should have
-                * InvalidTransactionId in relfrozenxid anyway.)
+                * Only consider relations able to hold unfrozen XIDs (anything else
+                * should have InvalidTransactionId in relfrozenxid anyway.)
                 */
                if (classForm->relkind != RELKIND_RELATION &&
                        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
         * relation.
         */
index b426a453242e465dbf42304ec48e796824dadbb5..175eff2bd0162af38a4d4a46e2c71c7c1343f6ad 100644 (file)
@@ -690,7 +690,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
                relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
                ereport(ERROR,
                                (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))));
 
        cancel_parser_errposition_callback(&pcbstate);
index fb576219627af1d03105a3884d2bc470852a0139..87ec979b852024ccfa844a257226e47608052947 100644 (file)
@@ -257,6 +257,8 @@ DefineQueryRewrite(char *rulename,
 
        /*
         * 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 &&
                event_relation->rd_rel->relkind != RELKIND_MATVIEW &&
index 58322dc59a6429bfe2134d07d142d6e703dfd4d9..247ad92ab2e01cff24c4eb49dc9814a731d0f7d7 100644 (file)
@@ -269,7 +269,7 @@ flagInhTables(TableInfo *tblinfo, int numTables,
 
        for (i = 0; i < numTables; i++)
        {
-               /* Sequences and views never have parents */
+               /* Some kinds never have parents */
                if (tblinfo[i].relkind == RELKIND_SEQUENCE ||
                        tblinfo[i].relkind == RELKIND_VIEW ||
                        tblinfo[i].relkind == RELKIND_MATVIEW)
@@ -315,7 +315,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables)
                int                     numParents;
                TableInfo **parents;
 
-               /* Sequences and views never have parents */
+               /* Some kinds never have parents */
                if (tbinfo->relkind == RELKIND_SEQUENCE ||
                        tbinfo->relkind == RELKIND_VIEW ||
                        tbinfo->relkind == RELKIND_MATVIEW)
index 4cd59bc3ea6eefb43eb5775bc6a1d1533fea6010..c94d0d8075314d5039f1b40373ee0b139408e2cc 100644 (file)
@@ -504,7 +504,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
                                                                         AccessShareLock, true);
        if (pmrel == NULL)
                return;
-       /* must be table or view, else ignore */
+       /* sanity-check the relation kind */
        if (!(pmrel->rd_rel->relkind == RELKIND_RELATION ||
                  pmrel->rd_rel->relkind == RELKIND_MATVIEW ||
                  pmrel->rd_rel->relkind == RELKIND_VIEW))
index 3c6b585e60db5acdcfc9a597643c8c165fa0cb7b..5f29b3978dd24e9a9f6ad91fabbbf63a4a7ede62 100644 (file)
@@ -221,7 +221,7 @@ NOTICE:  drop cascades to table inhe
 CREATE TABLE ctlt4 (a int, b text);
 CREATE SEQUENCE ctlseq1;
 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);
                                   ^
 CREATE VIEW ctlv1 AS SELECT * FROM ctlt4;