1ALTER MATERIALIZED VIEW(7)PostgreSQL 14.3 DocumentatioAnLTER MATERIALIZED VIEW(7)
2
3
4

NAME

6       ALTER_MATERIALIZED_VIEW - change the definition of a materialized view
7

SYNOPSIS

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           ALTER [ COLUMN ] column_name SET COMPRESSION compression_method
29           CLUSTER ON index_name
30           SET WITHOUT CLUSTER
31           SET TABLESPACE new_tablespace
32           SET ( storage_parameter [= value] [, ... ] )
33           RESET ( storage_parameter [, ... ] )
34           OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
35

DESCRIPTION

37       ALTER MATERIALIZED VIEW changes various auxiliary properties of an
38       existing materialized view.
39
40       You must own the materialized view to use ALTER MATERIALIZED VIEW. To
41       change a materialized view's schema, you must also have CREATE
42       privilege on the new schema. To alter the owner, you must also be a
43       direct or indirect member of the new owning role, and that role must
44       have CREATE privilege on the materialized view's schema. (These
45       restrictions enforce that altering the owner doesn't do anything you
46       couldn't do by dropping and recreating the materialized view. However,
47       a superuser can alter ownership of any view anyway.)
48
49       The statement subforms and actions available for ALTER MATERIALIZED
50       VIEW are a subset of those available for ALTER TABLE, and have the same
51       meaning when used for materialized views. See the descriptions for
52       ALTER TABLE for details.
53

PARAMETERS

55       name
56           The name (optionally schema-qualified) of an existing materialized
57           view.
58
59       column_name
60           Name of a new or existing column.
61
62       extension_name
63           The name of the extension that the materialized view is to depend
64           on (or no longer dependent on, if NO is specified). A materialized
65           view that's marked as dependent on an extension is automatically
66           dropped when the extension is dropped.
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

EXAMPLES

81       To rename the materialized view foo to bar:
82
83           ALTER MATERIALIZED VIEW foo RENAME TO bar;
84

COMPATIBILITY

86       ALTER MATERIALIZED VIEW is a PostgreSQL extension.
87

SEE ALSO

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 14.3                      2022           ALTER MATERIALIZED VIEW(7)
Impressum