1ALTER TYPE(7) SQL Commands ALTER TYPE(7)
2
3
4
6 ALTER TYPE - change the definition of a type
7
8
10 ALTER TYPE name RENAME TO new_name
11 ALTER TYPE name OWNER TO new_owner
12 ALTER TYPE name SET SCHEMA new_schema
13
14
15
17 ALTER TYPE changes the definition of an existing type.
18
19 You must own the type to use ALTER TYPE. To change the schema of a
20 type, you must also have CREATE privilege on the new schema. To alter
21 the owner, you must also be a direct or indirect member of the new own‐
22 ing role, and that role must have CREATE privilege on the type's
23 schema. (These restrictions enforce that altering the owner doesn't do
24 anything you couldn't do by dropping and recreating the type. However,
25 a superuser can alter ownership of any type anyway.)
26
28 name The name (possibly schema-qualified) of an existing type to
29 alter.
30
31 new_name
32 The new name for the type.
33
34 new_owner
35 The user name of the new owner of the type.
36
37 new_schema
38 The new schema for the type.
39
41 To rename a data type:
42
43 ALTER TYPE electronic_mail RENAME TO email;
44
45
46
47 To change the owner of the type email to joe:
48
49 ALTER TYPE email OWNER TO joe;
50
51
52
53 To change the schema of the type email to customers:
54
55 ALTER TYPE email SET SCHEMA customers;
56
57
58
60 There is no ALTER TYPE statement in the SQL standard.
61
62
63
64SQL - Language Statements 2014-02-17 ALTER TYPE(7)