8000 Update messages, comments and documentation for materialized views. · ThomasReport/postgres@cf18373 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf18373

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 462b562 commit cf18373

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
@@ -441,8 +441,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
441441
bool toast_delold[MaxHeapAttributeNumber];
442442

443443
/*
444-
* We should only ever be called for tuples of plain relations ---
445-
* recursing on a toast rel is bad news.
444+
* We should only ever be called for tuples of plain relations or
445+
* materialized views --- recursing on a toast rel is bad news.
446446
*/
447447
Assert(rel->rd_rel->relkind == RELKIND_RELATION ||
448448
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- EDBE
/* 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
@@ -1153,9 +1153,8 @@ heap_create_with_catalog(const char *relname,
11531153
/*
11541154
* Decide whether to create an array type over the relation's rowtype. We
11551155
* do not create any array types for system catalogs (ie, those made
1156-
* during initdb). We create array types for regular relations, views,
1157-
* composite types and foreign tables ... but not, eg, for toast tables or
1158-
* sequences.
1156+
* during initdb). We do not create them where the use of a relation as
1157+
* such is an implementation detail: toast tables, sequences and indexes.
11591158
*/
11601159
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
11611160
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(relationRelation, SnapshotNow, 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
@@ -10536,7 +10536,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
1053610536
relkind != RELKIND_FOREIGN_TABLE)
1053710537
ereport(ERROR,
1053810538
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
10539-
errmsg("\"%s\" is not a table, view, sequence, or foreign table",
10539+
errmsg("\"%s\" is not a table, view, materialized view, sequence, or foreign table",
1054010540
rv->relname)));
1054110541

1054210542
ReleaseSysCache(tuple);

src/backend/commands/typecmds.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2813,7 +2813,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
28132813
NULL,
28142814
format_type_be(domainOid));
28152815

2816-
/* Otherwise we can ignore views, composite types, etc */
2816+
/*
2817+
* Otherwise, we can ignore relations except those with both
2818+
* storage and user-chosen column types.
2819+
*
2820+
* XXX If an index-only scan could satisfy "col::some_domain" from
2821+
* a suitable expression index, this should also check expression
2822+
* index columns.
2823+
*/
28172824
if (rel->rd_rel->relkind != RELKIND_RELATION &&
28182825
rel->rd_rel->relkind != RELKIND_MATVIEW)
28192826
{

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
*/

src/backend/parser/parse_utilcmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
690690
relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
691691
ereport(ERROR,
692692
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
693-
errmsg("\"%s\" is not a table, view, composite type, or foreign table",
693+
errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table",
694694
RelationGetRelationName(relation))));
695695

696696
cancel_parser_errposition_callback(&pcbstate);

src/backend/rewrite/rewriteDefine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ DefineQueryRewrite(char *rulename,
257257

258258
/*
259259
* Verify relation is of a type that rules can sensibly be applied to.
260+
* Internal callers can target materialized views, but transformRuleStmt()
261+
* blocks them for users. Don't mention them in the error message.
260262
*/
261263
if (event_relation->rd_rel->relkind != RELKIND_RELATION &&
262264
event_relation->rd_rel->relkind != RELKIND_MATVIEW &&

src/bin/pg_dump/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ flagInhTables(TableInfo *tblinfo, int numTables,
269269

270270
for (i = 0; i < numTables; i++)
271271
{
272-
/* Sequences and views never have parents */
272+
/* Some kinds never have parents */
273273
if (tblinfo[i].relkind == RELKIND_SEQUENCE ||
274274
tblinfo[i].relkind == RELKIND_VIEW ||
275275
tblinfo[i].relkind == RELKIND_MATVIEW)
@@ -315,7 +315,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables)
315315
int numParents;
316316
TableInfo **parents;
317317

318-
/* Sequences and views never have parents */
318+
/* Some kinds never have parents */
319319
if (tbinfo->relkind == RELKIND_SEQUENCE ||
320320
tbinfo->relkind == RELKIND_VIEW ||
321321
tbinfo->relkind == RELKIND_MATVIEW)

src/pl/tcl/pltcl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ pltcl_init_load_unknown(Tcl_Interp *interp)
504504
AccessShareLock, true);
505505
if (pmrel == NULL)
506506
return;
507-
/* must be table or view, else ignore */
507+
/* sanity-check the relation kind */
508508
if (!(pmrel->rd_rel->relkind == RELKIND_RELATION ||
509509
pmrel->rd_rel->relkind == RELKIND_MATVIEW ||
510510
pmrel->rd_rel->relkind == RELKIND_VIEW))

src/test/regress/expected/create_table_like.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ NOTICE: drop cascades to table inhe
221221
CREATE TABLE ctlt4 (a int, b text);
222222
CREATE SEQUENCE ctlseq1;
223223
CREATE TABLE ctlt10 (LIKE ctlseq1); -- fail
224-
ERROR: "ctlseq1" is not a table, view, composite type, or foreign table
224+
ERROR: "ctlseq1" is not a table, view, materialized view, composite type, or foreign table
225225
LINE 1: CREATE TABLE ctlt10 (LIKE ctlseq1);
226226
^
227227
CREATE VIEW ctlv1 AS SELECT * FROM ctlt4;

0 commit comments

Comments
 (0)
0