4
4
<title>ALTER TYPE</title>
5
5
<link rel="stylesheet" href="stylesheet.css" type="text/css">
6
6
<link rev="made" href="pgsql-docs@postgresql.org">
7
<meta name="generator" content="DocBook XSL Stylesheets V1.64.1">
8
<link rel="home" href="index.html" title="PostgreSQL 8.0.0beta5 Documentation">
7
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
8
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
9
9
<link rel="up" href="sql-commands.html" title="SQL Commands">
10
<link rel="previous" href="sql-altertrigger.html" title="ALTER TRIGGER">
10
<link rel="prev" href="sql-altertrigger.html" title="ALTER TRIGGER">
11
11
<link rel="next" href="sql-alteruser.html" title="ALTER USER">
12
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
13
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
14
<a name="sql-altertype"></a><div class="titlepage">
15
<a name="sql-altertype"></a><div class="titlepage"></div>
18
16
<div class="refnamediv">
21
19
— change the definition of a type
24
<a name="id2664950"></a><div class="refsynopsisdiv">
22
<a name="id747339"></a><div class="refsynopsisdiv">
26
<pre class="synopsis">ALTER TYPE <i class="replaceable"><tt>name</tt></i> OWNER TO <i class="replaceable"><tt>new_owner</tt></i>
24
<pre class="synopsis">ALTER TYPE <em class="replaceable"><code>name</code></em> OWNER TO <em class="replaceable"><code>new_owner</code></em>
25
ALTER TYPE <em class="replaceable"><code>name</code></em> SET SCHEMA <em class="replaceable"><code>new_schema</code></em>
29
28
<div class="refsect1" lang="en">
30
<a name="id2664978"></a><h2>Description</h2>
31
<p> <tt class="command">ALTER TYPE</tt> changes the definition of an existing type.
32
The only currently available capability is changing the owner of a type.
29
<a name="id747384"></a><h2>Description</h2>
30
<p> <code class="command">ALTER TYPE</code> changes the definition of an existing type.
31
The only currently available capabilities are changing the owner and schema
34
<p> You must own the type to use <code class="command">ALTER TYPE</code>.
35
To change the schema of a type, you must also have
36
<code class="literal">CREATE</code> privilege on the new schema.
37
To alter the owner, you must also be a direct or indirect member of the new
38
owning role, and that role must have <code class="literal">CREATE</code> privilege on
39
the type's schema. (These restrictions enforce that altering the owner
40
doesn't do anything you couldn't do by dropping and recreating the type.
41
However, a superuser can alter ownership of any type anyway.)
35
44
<div class="refsect1" lang="en">
36
<a name="id2664991"></a><h2>Parameters</h2>
45
<a name="id747430"></a><h2>Parameters</h2>
38
47
<div class="variablelist"><dl>
39
<dt><span class="term"><i class="replaceable"><tt>name</tt></i></span></dt>
48
<dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt>
40
49
<dd><p> The name (possibly schema-qualified) of an existing type to
43
<dt><span class="term"><i class="replaceable"><tt>new_owner</tt></i></span></dt>
52
<dt><span class="term"><em class="replaceable"><code>new_owner</code></em></span></dt>
44
53
<dd><p> The user name of the new owner of the type.
45
You must be a superuser to change a type's owner.
55
<dt><span class="term"><em class="replaceable"><code>new_schema</code></em></span></dt>
56
<dd><p> The new schema for the type.
51
62
<div class="refsect1" lang="en">
52
<a name="id2665023"></a><h2>Examples</h2>
63
<a name="id747476"></a><h2>Examples</h2>
54
To change the owner of the user-defined type <tt class="literal">email</tt>
55
to <tt class="literal">joe</tt>:
65
To change the owner of the user-defined type <code class="literal">email</code>
66
to <code class="literal">joe</code>:
57
68
<pre class="programlisting">ALTER TYPE email OWNER TO joe;
72
<p> To change the schema of the user-defined type <code class="literal">email</code>
73
to <code class="literal">customers</code>:
75
<pre class="programlisting">ALTER TYPE email SET SCHEMA customers;
62
80
<div class="refsect1" lang="en">
63
<a name="id2665047"></a><h2>Compatibility</h2>
64
<p> There is no <tt class="command">ALTER TYPE</tt> statement in the SQL
81
<a name="id747527"></a><h2>Compatibility</h2>
82
<p> There is no <code class="command">ALTER TYPE</code> statement in the SQL