Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02d2b69

Browse files
committed
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.
1 parent 269e780 commit 02d2b69

File tree

15 files changed

+29
-22
lines changed

15 files changed

+29
-22
lines changed

doc/src/sgml/maintenance.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@
534534
examine this information is to execute queries such as:
535535

536536
<programlisting>
537-
SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind = 'r';
537+
SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind IN ('r', 'm');
538538
SELECT datname, age(datfrozenxid) FROM pg_database;
539539
</programlisting>
540540

src/backend/access/heap/tuptoaster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
512512
bool toast_delold[MaxHeapAttributeNumber];
513513

514514
/*
515-
* We should only ever be called for tuples of plain relations ---
516-
* recursing on a toast rel is bad news.
515+
* We should only ever be called for tuples of plain relations or
516+
* materialized views --- recursing on a toast rel is bad news.
517517
*/
518518
Assert(rel->rd_rel->relkind == RELKIND_RELATION ||
519519
rel->rd_rel->relkind == RELKIND_MATVIEW);

src/backend/catalog/aclchk.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ objectsInSchemaToOids(GrantObjectType objtype, List *nspnames)
761761
switch (objtype)
762762
{
763763
case ACL_OBJECT_RELATION:
764-
/* Process regular tables, views and foreign tables */
765764
objs = getRelationsInNamespace(namespaceId, RELKIND_RELATION);
766765
objects = list_concat(objects, objs);
767766
objs = getRelationsInNamespace(namespaceId, RELKIND_VIEW);

src/backend/catalog/heap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,9 +1152,8 @@ heap_create_with_catalog(const char *relname,
11521152
/*
11531153
* Decide whether to create an array type over the relation's rowtype. We
11541154
* do not create any array types for system catalogs (ie, those made
1155-
* during initdb). We create array types for regular relations, views,
1156-
* composite types and foreign tables ... but not, eg, for toast tables or
1157-
* sequences.
1155+
* during initdb). We do not create them where the use of a relation as
1156+
* such is an implementation detail: toast tables, sequences and indexes.
11581157
*/
11591158
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
11601159
relkind == RELKIND_VIEW ||

src/backend/commands/comment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ CommentObject(CommentStmt *stmt)
9898
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
9999
ereport(ERROR,
100100
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
101-
errmsg("\"%s\" is not a table, view, composite type, or foreign table",
101+
errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
102102
RelationGetRelationName(relation))));
103103
break;
104104
default:

src/backend/commands/indexcmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ DefineIndex(IndexStmt *stmt,
372372
else
373373
ereport(ERROR,
374374
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
375-
errmsg("\"%s\" is not a table",
375+
errmsg("\"%s\" is not a table or materialized view",
376376
RelationGetRelationName(rel))));
377377
}
378378

@@ -1834,8 +1834,8 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user)
18341834
/*
18351835
* Scan pg_class to build a list of the relations we need to reindex.
18361836
*
1837-
* We only consider plain relations here (toast rels will be processed
1838-
* indirectly by reindex_relation).
1837+
* We only consider plain relations and materialized views here (toast
1838+
* rels will be processed indirectly by reindex_relation).
18391839
*/
18401840
relationRelation = heap_open(RelationRelationId, AccessShareLock);
18411841
scan = heap_beginscan_catalog(relationRelation, 0, NULL);

src/backend/commands/seclabel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt)
111111
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
112112
ereport(ERROR,
113113
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
114-
errmsg("\"%s\" is not a table, view, composite type, or foreign table",
114+
errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
115115
RelationGetRelationName(relation))));
116116
break;
117117
default:

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10696,7 +10696,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
1069610696
relkind != RELKIND_FOREIGN_TABLE)
1069710697
ereport(ERROR,
1069810698
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
10699-
errmsg("\"%s\" is not a table, view, sequence, or foreign table",
10699+
errmsg("\"%s\" is not a table, view, materialized view, sequence, or foreign table",
1070010700
rv->relname)));
1070110701

1070210702
ReleaseSysCache(tuple);

src/backend/commands/typecmds.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2820,7 +2820,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
28202820
NULL,
28212821
format_type_be(domainOid));
28222822

2823-
/* Otherwise we can ignore views, composite types, etc */
2823+
/*
2824+
* Otherwise, we can ignore relations except those with both
2825+
* storage and user-chosen column types.
2826+
*
2827+
* XXX If an index-only scan could satisfy "col::some_domain" from
2828+
* a suitable expression index, this should also check expression
2829+
* index columns.
2830+
*/
28242831
if (rel->rd_rel->relkind != RELKIND_RELATION &&
28252832
rel->rd_rel->relkind != RELKIND_MATVIEW)
28262833
{

src/backend/commands/vacuum.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,8 @@ vac_update_datfrozenxid(void)
742742
Form_pg_class classForm = (Form_pg_class) GETSTRUCT(classTup);
743743

744744
/*
745-
* Only consider heap and TOAST tables (anything else should have
746-
* InvalidTransactionId in relfrozenxid anyway.)
745+
* Only consider relations able to hold unfrozen XIDs (anything else
746+
* should have InvalidTransactionId in relfrozenxid anyway.)
747747
*/
748748
if (classForm->relkind != RELKIND_RELATION &&
749749
classForm->relkind != RELKIND_MATVIEW &&
@@ -1044,7 +1044,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
10441044
}
10451045

10461046
/*
1047-
* Check that it's a vacuumable table; we used to do this in
1047+
* Check that it's a vacuumable relation; we used to do this in
10481048
* get_rel_oids() but seems safer to check after we've locked the
10491049
* relation.
10501050
*/

0 commit comments

Comments
 (0)