1ALTER MATERIALIZED VIEW(7)PostgreSQL 13.3 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 [ NO ] 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 statement subforms and actions available for ALTER MATERIALIZED
48 VIEW are a subset of those available for ALTER TABLE, and have the same
49 meaning when used for materialized views. See the descriptions for
50 ALTER TABLE (ALTER_TABLE(7)) for details.
51
53 name
54 The name (optionally schema-qualified) of an existing materialized
55 view.
56
57 column_name
58 Name of a new or existing column.
59
60 extension_name
61 The name of the extension that the materialized view is to depend
62 on (or no longer dependent on, if NO is specified). A materialized
63 view that's marked as dependent on an extension is automatically
64 dropped when the extension is dropped.
65
66 new_column_name
67 New name for an existing column.
68
69 new_owner
70 The user name of the new owner of the materialized view.
71
72 new_name
73 The new name for the materialized view.
74
75 new_schema
76 The new schema for the materialized view.
77
79 To rename the materialized view foo to bar:
80
81 ALTER MATERIALIZED VIEW foo RENAME TO bar;
82
84 ALTER MATERIALIZED VIEW is a PostgreSQL extension.
85
87 CREATE MATERIALIZED VIEW (CREATE_MATERIALIZED_VIEW(7)), DROP
88 MATERIALIZED VIEW (DROP_MATERIALIZED_VIEW(7)), REFRESH MATERIALIZED
89 VIEW (REFRESH_MATERIALIZED_VIEW(7))
90
91
92
93PostgreSQL 13.3 2021 ALTER MATERIALIZED VIEW(7)