1ALTER MATERIALIZED VIEW(7)PostgreSQL 15.4 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 ACCESS METHOD new_access_method
32           SET TABLESPACE new_tablespace
33           SET ( storage_parameter [= value] [, ... ] )
34           RESET ( storage_parameter [, ... ] )
35           OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
36

DESCRIPTION

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

PARAMETERS

56       name
57           The name (optionally schema-qualified) of an existing materialized
58           view.
59
60       column_name
61           Name of a new or existing column.
62
63       extension_name
64           The name of the extension that the materialized view is to depend
65           on (or no longer dependent on, if NO is specified). A materialized
66           view that's marked as dependent on an extension is automatically
67           dropped when the extension is dropped.
68
69       new_column_name
70           New name for an existing column.
71
72       new_owner
73           The user name of the new owner of the materialized view.
74
75       new_name
76           The new name for the materialized view.
77
78       new_schema
79           The new schema for the materialized view.
80

EXAMPLES

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

COMPATIBILITY

87       ALTER MATERIALIZED VIEW is a PostgreSQL extension.
88

SEE ALSO

90       CREATE MATERIALIZED VIEW (CREATE_MATERIALIZED_VIEW(7)), DROP
91       MATERIALIZED VIEW (DROP_MATERIALIZED_VIEW(7)), REFRESH MATERIALIZED
92       VIEW (REFRESH_MATERIALIZED_VIEW(7))
93
94
95
96PostgreSQL 15.4                      2023           ALTER MATERIALIZED VIEW(7)
Impressum