]> begriffs open source - ai-pg/blob - full-docs/txt/sql-altermaterializedview.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-altermaterializedview.txt
1
2 ALTER MATERIALIZED VIEW
3
4    ALTER MATERIALIZED VIEW — change the definition of a materialized view
5
6 Synopsis
7
8 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
9     action [, ... ]
10 ALTER MATERIALIZED VIEW name
11     [ NO ] DEPENDS ON EXTENSION extension_name
12 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
13     RENAME [ COLUMN ] column_name TO new_column_name
14 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
15     RENAME TO new_name
16 ALTER MATERIALIZED VIEW [ IF EXISTS ] name
17     SET SCHEMA new_schema
18 ALTER MATERIALIZED VIEW ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ]
19     SET TABLESPACE new_tablespace [ NOWAIT ]
20
21 where action is one of:
22
23     ALTER [ COLUMN ] column_name SET STATISTICS integer
24     ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] )
25     ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] )
26     ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAI
27 N | DEFAULT }
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
37 Description
38
39    ALTER MATERIALIZED VIEW changes various auxiliary properties of an
40    existing materialized view.
41
42    You must own the materialized view to use ALTER MATERIALIZED VIEW. To
43    change a materialized view's schema, you must also have CREATE
44    privilege on the new schema. To alter the owner, you must be able to
45    SET ROLE to the new owning role, and that role must have CREATE
46    privilege on the materialized view's schema. (These restrictions
47    enforce that altering the owner doesn't do anything you couldn't do by
48    dropping and recreating the materialized view. However, a superuser can
49    alter ownership of any view anyway.)
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 for details.
55
56 Parameters
57
58    name
59           The name (optionally schema-qualified) of an existing
60           materialized view.
61
62    column_name
63           Name of an existing column.
64
65    extension_name
66           The name of the extension that the materialized view is to
67           depend on (or no longer dependent on, if NO is specified). A
68           materialized view that's marked as dependent on an extension is
69           automatically dropped when the extension is dropped.
70
71    new_column_name
72           New name for an existing column.
73
74    new_owner
75           The user name of the new owner of the materialized view.
76
77    new_name
78           The new name for the materialized view.
79
80    new_schema
81           The new schema for the materialized view.
82
83 Examples
84
85    To rename the materialized view foo to bar:
86 ALTER MATERIALIZED VIEW foo RENAME TO bar;
87
88 Compatibility
89
90    ALTER MATERIALIZED VIEW is a PostgreSQL extension.
91
92 See Also
93
94    CREATE MATERIALIZED VIEW, DROP MATERIALIZED VIEW, REFRESH MATERIALIZED
95    VIEW