1ALTER MATERIALIZED VIEW(7)PostgreSQL 12.6 DocumentatioAnLTER MATERIALIZED VIEW(7)
2
3
4
6 ALTER_MATERIALIZED_VIEW - change the definition of a materialized view
7
9 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
10 action [, ... ]
11 ALTER MATERIALIZED VIEW name
12 DEPENDS ON EXTENSION extension_name
13 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
14 RENAME [ COLUMN ] column_name TO new_column_name
15 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
16 RENAME TO new_name
17 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
18 SET SCHEMA new_schema
19 ALTER MATERIALIZED VIEW ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ]
20 SET TABLESPACE new_tablespace [ NOWAIT ]
21
22 where action is one of:
23
24 ALTER [ COLUMN ] column_name SET STATISTICS integer
25 ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] )
26 ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] )
27 ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
28 CLUSTER ON index_name
29 SET WITHOUT CLUSTER
30 SET ( storage_parameter [= value] [, ... ] )
31 RESET ( storage_parameter [, ... ] )
32 OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
33
35 ALTER MATERIALIZED VIEW changes various auxiliary properties of an
36 existing materialized view.
37
38 You must own the materialized view to use ALTER MATERIALIZED VIEW. To
39 change a materialized view's schema, you must also have CREATE
40 privilege on the new schema. To alter the owner, you must also be a
41 direct or indirect member of the new owning role, and that role must
42 have CREATE privilege on the materialized view's schema. (These
43 restrictions enforce that altering the owner doesn't do anything you
44 couldn't do by dropping and recreating the materialized view. However,
45 a superuser can alter ownership of any view anyway.)
46
47 The DEPENDS ON EXTENSION form marks the materialized view as dependent
48 on an extension, such that the materialized view will automatically be
49 dropped if the extension is dropped.
50
51 The statement subforms and actions available for ALTER MATERIALIZED
52 VIEW are a subset of those available for ALTER TABLE, and have the same
53 meaning when used for materialized views. See the descriptions for
54 ALTER TABLE (ALTER_TABLE(7)) for details.
55
57 name
58 The name (optionally schema-qualified) of an existing materialized
59 view.
60
61 column_name
62 Name of a new or existing column.
63
64 extension_name
65 The name of the extension that the materialized view is to depend
66 on.
67
68 new_column_name
69 New name for an existing column.
70
71 new_owner
72 The user name of the new owner of the materialized view.
73
74 new_name
75 The new name for the materialized view.
76
77 new_schema
78 The new schema for the materialized view.
79
81 To rename the materialized view foo to bar:
82
83 ALTER MATERIALIZED VIEW foo RENAME TO bar;
84
86 ALTER MATERIALIZED VIEW is a PostgreSQL extension.
87
89 CREATE MATERIALIZED VIEW (CREATE_MATERIALIZED_VIEW(7)), DROP
90 MATERIALIZED VIEW (DROP_MATERIALIZED_VIEW(7)), REFRESH MATERIALIZED
91 VIEW (REFRESH_MATERIALIZED_VIEW(7))
92
93
94
95PostgreSQL 12.6 2021 ALTER MATERIALIZED VIEW(7)