1ALTER VIEW(7) SQL Commands ALTER VIEW(7)
2
3
4
6 ALTER VIEW - change the definition of a view
7
8
10 ALTER VIEW name ALTER [ COLUMN ] column SET DEFAULT expression
11 ALTER VIEW name ALTER [ COLUMN ] column DROP DEFAULT
12 ALTER VIEW name OWNER TO new_owner
13 ALTER VIEW name RENAME TO new_name
14 ALTER VIEW name SET SCHEMA new_schema
15
16
18 ALTER VIEW changes various auxiliary properties of a view. (If you want
19 to modify the view's defining query, use CREATE OR REPLACE VIEW.)
20
21 You must own the view to use ALTER VIEW. To change a view's schema,
22 you must also have CREATE privilege on the new schema. To alter the
23 owner, you must also be a direct or indirect member of the new owning
24 role, and that role must have CREATE privilege on the view's schema.
25 (These restrictions enforce that altering the owner doesn't do anything
26 you couldn't do by dropping and recreating the view. However, a supe‐
27 ruser can alter ownership of any view anyway.)
28
30 name The name (optionally schema-qualified) of an existing view.
31
32 SET/DROP DEFAULT
33 These forms set or remove the default value for a column. A
34 default value associated with a view column is inserted into
35 INSERT statements on the view before the view's ON INSERT rule
36 is applied, if the INSERT does not specify a value for the col‐
37 umn.
38
39 new_owner
40 The user name of the new owner of the view.
41
42 new_name
43 The new name for the view.
44
45 new_schema
46 The new schema for the view.
47
49 For historical reasons, ALTER TABLE can be used with views too; but the
50 only variants of ALTER TABLE that are allowed with views are equivalent
51 to the ones shown above.
52
54 To rename the view foo to bar:
55
56 ALTER VIEW foo RENAME TO bar;
57
58
60 ALTER VIEW is a PostgreSQL extension of the SQL standard.
61
63 CREATE VIEW [create_view(7)], DROP VIEW [drop_view(7)]
64
65
66
67SQL - Language Statements 2014-02-17 ALTER VIEW(7)