Skip to content

Commit 0adfa2c

Browse files
committed
Support renaming of tablespaces, and changing the owners of
aggregates, conversions, functions, operators, operator classes, schemas, types, and tablespaces. Fold the existing implementations of alter domain owner and alter database owner in with these. Christopher Kings-Lynne
1 parent 1621192 commit 0adfa2c

40 files changed

+1378
-232
lines changed

doc/src/sgml/ref/allfiles.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.58 2004/06/18 21:24:01 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.59 2004/06/25 21:55:50 tgl Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -13,11 +13,14 @@ Complete list of usable sgml source files in this directory.
1313
<!entity alterFunction system "alter_function.sgml">
1414
<!entity alterGroup system "alter_group.sgml">
1515
<!entity alterLanguage system "alter_language.sgml">
16+
<!entity alterOperator system "alter_operator.sgml">
1617
<!entity alterOperatorClass system "alter_opclass.sgml">
1718
<!entity alterSchema system "alter_schema.sgml">
1819
<!entity alterSequence system "alter_sequence.sgml">
1920
<!entity alterTable system "alter_table.sgml">
21+
<!entity alterTableSpace system "alter_tablespace.sgml">
2022
<!entity alterTrigger system "alter_trigger.sgml">
23+
<!entity alterType system "alter_type.sgml">
2124
<!entity alterUser system "alter_user.sgml">
2225
<!entity analyze system "analyze.sgml">
2326
<!entity begin system "begin.sgml">

doc/src/sgml/ref/alter_aggregate.sgml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.4 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,6 +21,7 @@ PostgreSQL documentation
2121
<refsynopsisdiv>
2222
<synopsis>
2323
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) RENAME TO <replaceable>newname</replaceable>
24+
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) OWNER TO <replaceable>newowner</replaceable>
2425
</synopsis>
2526
</refsynopsisdiv>
2627

@@ -29,8 +30,7 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
2930

3031
<para>
3132
<command>ALTER AGGREGATE</command> changes the definition of an
32-
aggregate function. The only currently available functionality is to
33-
rename the aggregate function.
33+
aggregate function.
3434
</para>
3535
</refsect1>
3636

@@ -65,6 +65,16 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
6565
</para>
6666
</listitem>
6767
</varlistentry>
68+
69+
<varlistentry>
70+
<term><replaceable class="parameter">newowner</replaceable></term>
71+
<listitem>
72+
<para>
73+
The new owner of the aggregate function.
74+
You must be a superuser to change an aggregate's owner.
75+
</para>
76+
</listitem>
77+
</varlistentry>
6878
</variablelist>
6979
</refsect1>
7080

@@ -76,6 +86,14 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
7686
<type>integer</type> to <literal>my_average</literal>:
7787
<programlisting>
7888
ALTER AGGREGATE myavg(integer) RENAME TO my_average;
89+
</programlisting>
90+
</para>
91+
92+
<para>
93+
To change the owner of the aggregate function <literal>myavg</literal> for type
94+
<type>integer</type> to <literal>joe</literal>:
95+
<programlisting>
96+
ALTER AGGREGATE myavg(integer) OWNER TO joe;
7997
</programlisting>
8098
</para>
8199
</refsect1>

doc/src/sgml/ref/alter_conversion.sgml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.4 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,6 +21,7 @@ PostgreSQL documentation
2121
<refsynopsisdiv>
2222
<synopsis>
2323
ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
24+
ALTER CONVERSION <replaceable>name</replaceable> OWNER TO <replaceable>newowner</replaceable>
2425
</synopsis>
2526
</refsynopsisdiv>
2627

@@ -29,7 +30,6 @@ ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname<
2930

3031
<para>
3132
<command>ALTER CONVERSION</command> changes the definition of a
32-
conversion. The only currently available functionality is to rename the
3333
conversion.
3434
</para>
3535
</refsect1>
@@ -55,6 +55,16 @@ ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname<
5555
</para>
5656
</listitem>
5757
</varlistentry>
58+
59+
<varlistentry>
60+
<term><replaceable class="parameter">newowner</replaceable></term>
61+
<listitem>
62+
<para>
63+
The new owner of the conversion. To change the owner of a conversion,
64+
you must be a superuser.
65+
</para>
66+
</listitem>
67+
</varlistentry>
5868
</variablelist>
5969
</refsect1>
6070

@@ -66,6 +76,14 @@ ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname<
6676
<literal>latin1_to_unicode</literal>:
6777
<programlisting>
6878
ALTER CONVERSION iso_8859_1_to_utf_8 RENAME TO latin1_to_unicode;
79+
</programlisting>
80+
</para>
81+
82+
<para>
83+
To change the owner of the conversion <literal>iso_8859_1_to_utf_8</literal> to
84+
<literal>joe</literal>:
85+
<programlisting>
86+
ALTER CONVERSION iso_8859_1_to_utf_8 OWNER TO joe;
6987
</programlisting>
7088
</para>
7189
</refsect1>

doc/src/sgml/ref/alter_function.sgml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.4 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,6 +21,7 @@ PostgreSQL documentation
2121
<refsynopsisdiv>
2222
<synopsis>
2323
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable>
24+
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) OWNER TO <replaceable>newowner</replaceable>
2425
</synopsis>
2526
</refsynopsisdiv>
2627

@@ -29,7 +30,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter
2930

3031
<para>
3132
<command>ALTER FUNCTION</command> changes the definition of a
32-
function. The only functionality is to rename the function.
33+
function.
3334
</para>
3435
</refsect1>
3536

@@ -63,6 +64,19 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter
6364
</para>
6465
</listitem>
6566
</varlistentry>
67+
68+
<varlistentry>
69+
<term><replaceable class="parameter">newowner</replaceable></term>
70+
<listitem>
71+
<para>
72+
The new owner of the function.
73+
To change the owner of a function, you must be a superuser.
74+
Note that if the function is marked
75+
<literal>SECURITY DEFINER</literal>,
76+
it will subsequently execute as the new owner.
77+
</para>
78+
</listitem>
79+
</varlistentry>
6680
</variablelist>
6781
</refsect1>
6882

@@ -74,6 +88,14 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter
7488
<type>integer</type> to <literal>square_root</literal>:
7589
<programlisting>
7690
ALTER FUNCTION sqrt(integer) RENAME TO square_root;
91+
</programlisting>
92+
</para>
93+
94+
<para>
95+
To change the owner of the function <literal>sqrt</literal> for type
96+
<type>integer</type> to <literal>joe</literal>:
97+
<programlisting>
98+
ALTER FUNCTION sqrt(integer) OWNER TO joe;
7799
</programlisting>
78100
</para>
79101
</refsect1>
@@ -84,7 +106,7 @@ ALTER FUNCTION sqrt(integer) RENAME TO square_root;
84106
<para>
85107
There is an <command>ALTER FUNCTION</command> statement in the SQL
86108
standard, but it does not provide the option to rename the
87-
function.
109+
function or change the owner.
88110
</para>
89111
</refsect1>
90112

doc/src/sgml/ref/alter_opclass.sgml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_opclass.sgml,v 1.4 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_opclass.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,6 +21,7 @@ PostgreSQL documentation
2121
<refsynopsisdiv>
2222
<synopsis>
2323
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable>
24+
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> OWNER TO <replaceable>newowner</replaceable>
2425
</synopsis>
2526
</refsynopsisdiv>
2627

@@ -29,8 +30,7 @@ ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="p
2930

3031
<para>
3132
<command>ALTER OPERATOR CLASS</command> changes the definition of
32-
an operator class. The only functionality is to rename the
33-
operator class.
33+
an operator class.
3434
</para>
3535
</refsect1>
3636

@@ -65,7 +65,17 @@ ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="p
6565
</para>
6666
</listitem>
6767
</varlistentry>
68-
</variablelist>
68+
69+
<varlistentry>
70+
<term><replaceable class="parameter">newowner</replaceable></term>
71+
<listitem>
72+
<para>
73+
The new owner of the operator class.
74+
You must be a superuser to change the owner of an operator class.
75+
</para>
76+
</listitem>
77+
</varlistentry>
78+
</variablelist>
6979
</refsect1>
7080

7181
<refsect1>

doc/src/sgml/ref/alter_operator.sgml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_operator.sgml,v 1.1 2004/06/25 21:55:50 tgl Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-ALTEROPERATOR">
7+
<refmeta>
8+
<refentrytitle id="SQL-ALTEROPERATOR-TITLE">ALTER OPERATOR</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>ALTER OPERATOR</refname>
14+
<refpurpose>change the definition of an operator</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-alteroperator">
18+
<primary>ALTER OPERATOR</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>lefttype</replaceable> | NONE } , { <replaceable>righttype</replaceable> | NONE } ) OWNER TO <replaceable>newowner</replaceable>
24+
</synopsis>
25+
</refsynopsisdiv>
26+
27+
<refsect1>
28+
<title>Description</title>
29+
30+
<para>
31+
<command>ALTER OPERATOR</command> changes the definition of
32+
an operator. The only currently available functionality is to change the
33+
owner of the operator.
34+
</para>
35+
</refsect1>
36+
37+
<refsect1>
38+
<title>Parameters</title>
39+
40+
<variablelist>
41+
<varlistentry>
42+
<term><replaceable class="parameter">name</replaceable></term>
43+
<listitem>
44+
<para>
45+
The name (optionally schema-qualified) of an existing operator.
46+
</para>
47+
</listitem>
48+
</varlistentry>
49+
50+
<varlistentry>
51+
<term><replaceable class="parameter">lefttype</replaceable></term>
52+
<listitem>
53+
<para>
54+
The data type of the operator's left operand; write
55+
<literal>NONE</literal> if the operator has no left operand.
56+
</para>
57+
</listitem>
58+
</varlistentry>
59+
60+
<varlistentry>
61+
<term><replaceable class="parameter">righttype</replaceable></term>
62+
<listitem>
63+
<para>
64+
The data type of the operator's right operand; write
65+
<literal>NONE</literal> if the operator has no right operand.
66+
</para>
67+
</listitem>
68+
</varlistentry>
69+
70+
<varlistentry>
71+
<term><replaceable class="parameter">newowner</replaceable></term>
72+
<listitem>
73+
<para>
74+
The new owner of the operator.
75+
You must be a superuser to change the owner of an operator.
76+
</para>
77+
</listitem>
78+
</varlistentry>
79+
</variablelist>
80+
</refsect1>
81+
82+
<refsect1>
83+
<title>Examples</title>
84+
85+
<para>
86+
Change the owner of a custom operator <literal>a @@ b</literal> for type <type>text</type>:
87+
<programlisting>
88+
ALTER OPERATOR @@ (text, text) OWNER TO joe;
89+
</programlisting>
90+
</para>
91+
</refsect1>
92+
93+
<refsect1>
94+
<title>Compatibility</title>
95+
96+
<para>
97+
There is no <command>ALTER OPERATOR</command> statement in
98+
the SQL standard.
99+
</para>
100+
</refsect1>
101+
102+
<refsect1>
103+
<title>See Also</title>
104+
105+
<simplelist type="inline">
106+
<member><xref linkend="sql-createoperator" endterm="sql-createoperator-title"></member>
107+
<member><xref linkend="sql-dropoperator" endterm="sql-dropoperator-title"></member>
108+
</simplelist>
109+
</refsect1>
110+
</refentry>
111+
112+
<!-- Keep this comment at the end of the file
113+
Local variables:
114+
mode: sgml
115+
sgml-omittag:nil
116+
sgml-shorttag:t
117+
sgml-minimize-attributes:nil
118+
sgml-always-quote-attributes:t
119+
sgml-indent-step:1
120+
sgml-indent-data:t
121+
sgml-parent-document:nil
122+
sgml-default-dtd-file:"../reference.ced"
123+
sgml-exposed-tags:nil
124+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
125+
sgml-local-ecat-files:nil
126+
End:
127+
-->

0 commit comments

Comments
 (0)