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