1ALTER VIEW(7)           PostgreSQL 9.2.24 Documentation          ALTER VIEW(7)
2
3
4

NAME

6       ALTER_VIEW - change the definition of a view
7

SYNOPSIS

9       ALTER VIEW [ IF EXISTS ] name ALTER [ COLUMN ] column_name SET DEFAULT expression
10       ALTER VIEW [ IF EXISTS ] name ALTER [ COLUMN ] column_name DROP DEFAULT
11       ALTER VIEW [ IF EXISTS ] name OWNER TO new_owner
12       ALTER VIEW [ IF EXISTS ] name RENAME TO new_name
13       ALTER VIEW [ IF EXISTS ] name SET SCHEMA new_schema
14       ALTER VIEW [ IF EXISTS ] name SET ( view_option_name [= view_option_value] [, ... ] )
15       ALTER VIEW [ IF EXISTS ] name RESET ( view_option_name [, ... ] )
16

DESCRIPTION

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, you
22       must also have CREATE privilege on the new schema. To alter the owner,
23       you must also be a direct or indirect member of the new owning role,
24       and that role must have CREATE privilege on the view's schema. (These
25       restrictions enforce that altering the owner doesn't do anything you
26       couldn't do by dropping and recreating the view. However, a superuser
27       can alter ownership of any view anyway.)
28

PARAMETERS

30       name
31           The name (optionally schema-qualified) of an existing view.
32
33       IF EXISTS
34           Do not throw an error if the view does not exist. A notice is
35           issued in this case.
36
37       SET/DROP DEFAULT
38           These forms set or remove the default value for a column. A default
39           value associated with a view column is inserted into INSERT
40           statements on the view before the view's ON INSERT rule is applied,
41           if the INSERT does not specify a value for the column.
42
43       new_owner
44           The user name of the new owner of the view.
45
46       new_name
47           The new name for the view.
48
49       new_schema
50           The new schema for the view.
51
52       view_option_name
53           The name of a view option to be set or reset.
54
55       view_option_value
56           The new value for a view option.
57

NOTES

59       For historical reasons, ALTER TABLE can be used with views too; but the
60       only variants of ALTER TABLE that are allowed with views are equivalent
61       to the ones shown above.
62

EXAMPLES

64       To rename the view foo to bar:
65
66           ALTER VIEW foo RENAME TO bar;
67

COMPATIBILITY

69       ALTER VIEW is a PostgreSQL extension of the SQL standard.
70

SEE ALSO

72       CREATE VIEW (CREATE_VIEW(7)), DROP VIEW (DROP_VIEW(7))
73
74
75
76PostgreSQL 9.2.24                 2017-11-06                     ALTER VIEW(7)
Impressum