Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf58434f

Browse files
committed
Documentation for ALTER object SET SCHEMA commands. Also some minor
editorialization.
1 parent614b6e2 commitf58434f

File tree

6 files changed

+193
-37
lines changed

6 files changed

+193
-37
lines changed

‎doc/src/sgml/ref/alter_aggregate.sgml

Lines changed: 31 additions & 6 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.5 2004/06/25 21:55:50 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.6 2005/08/01 16:11:14 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -20,8 +20,9 @@ PostgreSQL documentation
2020

2121
<refsynopsisdiv>
2222
<synopsis>
23-
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>
23+
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) RENAME TO <replaceable>new_name</replaceable>
24+
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) OWNER TO <replaceable>new_owner</replaceable>
25+
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) SET SCHEMA <replaceable>new_schema</replaceable>
2526
</synopsis>
2627
</refsynopsisdiv>
2728

@@ -32,6 +33,14 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
3233
<command>ALTER AGGREGATE</command> changes the definition of an
3334
aggregate function.
3435
</para>
36+
37+
<para>
38+
You must own the aggregate function to use <command>ALTER AGGREGATE</>;
39+
except for <command>ALTER AGGREGATE OWNER</>, which may only be executed by
40+
a superuser.
41+
To change the schema of an aggregate function, you must also have
42+
<literal>CREATE</literal> privilege on the new schema.
43+
</para>
3544
</refsect1>
3645

3746
<refsect1>
@@ -58,7 +67,7 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
5867
</varlistentry>
5968

6069
<varlistentry>
61-
<term><replaceable class="parameter">newname</replaceable></term>
70+
<term><replaceable class="parameter">new_name</replaceable></term>
6271
<listitem>
6372
<para>
6473
The new name of the aggregate function.
@@ -67,11 +76,19 @@ ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable
6776
</varlistentry>
6877

6978
<varlistentry>
70-
<term><replaceable class="parameter">newowner</replaceable></term>
79+
<term><replaceable class="parameter">new_owner</replaceable></term>
7180
<listitem>
7281
<para>
7382
The new owner of the aggregate function.
74-
You must be a superuser to change an aggregate's owner.
83+
</para>
84+
</listitem>
85+
</varlistentry>
86+
87+
<varlistentry>
88+
<term><replaceable class="parameter">new_schema</replaceable></term>
89+
<listitem>
90+
<para>
91+
The new schema for the aggregate function.
7592
</para>
7693
</listitem>
7794
</varlistentry>
@@ -94,6 +111,14 @@ ALTER AGGREGATE myavg(integer) RENAME TO my_average;
94111
<type>integer</type> to <literal>joe</literal>:
95112
<programlisting>
96113
ALTER AGGREGATE myavg(integer) OWNER TO joe;
114+
</programlisting>
115+
</para>
116+
117+
<para>
118+
To move the aggregate function <literal>myavg</literal> for type
119+
<type>integer</type> into schema <literal>myschema</literal>:
120+
<programlisting>
121+
ALTER AGGREGATE myavg(integer) SET SCHEMA myschema;
97122
</programlisting>
98123
</para>
99124
</refsect1>

‎doc/src/sgml/ref/alter_domain.sgml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_domain.sgml,v 1.16 2005/07/14 06:17:36 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_domain.sgml,v 1.17 2005/08/01 16:11:14 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -34,6 +34,8 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
3434
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> [ RESTRICT | CASCADE ]
3535
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
3636
OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
37+
ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
38+
SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
3739
</synopsis>
3840
</refsynopsisdiv>
3941

@@ -97,11 +99,23 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
9799
</para>
98100
</listitem>
99101
</varlistentry>
102+
103+
<varlistentry>
104+
<term>SET SCHEMA</term>
105+
<listitem>
106+
<para>
107+
This form changes the schema of the domain. Any constraints
108+
associated with the domain are moved into the new schema as well.
109+
</para>
110+
</listitem>
111+
</varlistentry>
100112
</variablelist>
101113

102114
<para>
103115
You must own the domain to use <command>ALTER DOMAIN</>; except for
104116
<command>ALTER DOMAIN OWNER</>, which may only be executed by a superuser.
117+
To change a domain's schema, you must also have <literal>CREATE</>
118+
privilege on the new schema.
105119
</para>
106120
</refsect1>
107121

@@ -114,8 +128,8 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
114128
<term><replaceable class="PARAMETER">name</replaceable></term>
115129
<listitem>
116130
<para>
117-
The name (possibly schema-qualified) of an existing domain to
118-
alter.
131+
The name (possibly schema-qualified) of an existing domain to
132+
alter.
119133
</para>
120134
</listitem>
121135
</varlistentry>
@@ -124,7 +138,7 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
124138
<term><replaceable class="PARAMETER">domain_constraint</replaceable></term>
125139
<listitem>
126140
<para>
127-
New domain constraint for the domain.
141+
New domain constraint for the domain.
128142
</para>
129143
</listitem>
130144
</varlistentry>
@@ -133,7 +147,7 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
133147
<term><replaceable class="PARAMETER">constraint_name</replaceable></term>
134148
<listitem>
135149
<para>
136-
Name of an existing constraint to drop.
150+
Name of an existing constraint to drop.
137151
</para>
138152
</listitem>
139153
</varlistentry>
@@ -152,7 +166,7 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
152166
<listitem>
153167
<para>
154168
Refuse to drop the constraint if there are any dependent
155-
objects. This is the default behavior.
169+
objects. This is the default behavior.
156170
</para>
157171
</listitem>
158172
</varlistentry>
@@ -161,7 +175,16 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
161175
<term><replaceable class="PARAMETER">new_owner</replaceable></term>
162176
<listitem>
163177
<para>
164-
The user name of the new owner of the domain.
178+
The user name of the new owner of the domain.
179+
</para>
180+
</listitem>
181+
</varlistentry>
182+
183+
<varlistentry>
184+
<term><replaceable class="PARAMETER">new_schema</replaceable></term>
185+
<listitem>
186+
<para>
187+
The new schema for the domain.
165188
</para>
166189
</listitem>
167190
</varlistentry>
@@ -197,15 +220,22 @@ ALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5);
197220
ALTER DOMAIN zipcode DROP CONSTRAINT zipchk;
198221
</programlisting>
199222
</para>
223+
224+
<para>
225+
To move the domain into a different schema:
226+
<programlisting>
227+
ALTER DOMAIN zipcode SET SCHEMA customers;
228+
</programlisting>
229+
</para>
200230
</refsect1>
201231

202232
<refsect1 id="SQL-ALTERDOMAIN-compatibility">
203233
<title>Compatibility</title>
204234

205235
<para>
206-
The<command>ALTER DOMAIN</command>statement is compatiblewith SQL:2003,
207-
except for the <literal>OWNER</>variant, which is a
208-
<productname>PostgreSQL</productname>extension.
236+
<command>ALTER DOMAIN</command>conformswith<acronym>SQL:2003</acronym>,
237+
except for the <literal>OWNER</>and <literal>SET SCHEMA</> variants,
238+
which are<productname>PostgreSQL</productname>extensions.
209239
</para>
210240
</refsect1>
211241

‎doc/src/sgml/ref/alter_function.sgml

Lines changed: 33 additions & 8 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.7 2005/05/26 20:05:03 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.8 2005/08/01 16:11:14 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -23,9 +23,11 @@ PostgreSQL documentation
2323
ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] )
2424
<replaceable class="PARAMETER">action</replaceable> [, ... ] [ RESTRICT ]
2525
ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] )
26-
RENAME TO <replaceable>newname</replaceable>
26+
RENAME TO <replaceable>new_name</replaceable>
2727
ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] )
28-
OWNER TO <replaceable>newowner</replaceable>
28+
OWNER TO <replaceable>new_owner</replaceable>
29+
ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] )
30+
SET SCHEMA <replaceable>new_schema</replaceable>
2931

3032
where <replaceable class="PARAMETER">action</replaceable> is one of:
3133

@@ -42,6 +44,13 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
4244
<command>ALTER FUNCTION</command> changes the definition of a
4345
function.
4446
</para>
47+
48+
<para>
49+
You must own the function to use <command>ALTER FUNCTION</>; except for
50+
<command>ALTER FUNCTION OWNER</>, which may only be executed by a superuser.
51+
To change a function's schema, you must also have <literal>CREATE</>
52+
privilege on the new schema.
53+
</para>
4554
</refsect1>
4655

4756
<refsect1>
@@ -98,7 +107,7 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
98107
</varlistentry>
99108

100109
<varlistentry>
101-
<term><replaceable class="parameter">newname</replaceable></term>
110+
<term><replaceable class="parameter">new_name</replaceable></term>
102111
<listitem>
103112
<para>
104113
The new name of the function.
@@ -107,17 +116,25 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
107116
</varlistentry>
108117

109118
<varlistentry>
110-
<term><replaceable class="parameter">newowner</replaceable></term>
119+
<term><replaceable class="parameter">new_owner</replaceable></term>
111120
<listitem>
112121
<para>
113-
The new owner of the function. To change the owner of a
114-
function, you must be a superuser. Note that if the function is
122+
The new owner of the function. Note that if the function is
115123
marked <literal>SECURITY DEFINER</literal>, it will subsequently
116124
execute as the new owner.
117125
</para>
118126
</listitem>
119127
</varlistentry>
120128

129+
<varlistentry>
130+
<term><replaceable class="parameter">new_schema</replaceable></term>
131+
<listitem>
132+
<para>
133+
The new schema for the function.
134+
</para>
135+
</listitem>
136+
</varlistentry>
137+
121138
<varlistentry>
122139
<term><literal>CALLED ON NULL INPUT</literal></term>
123140
<term><literal>RETURNS NULL ON NULL INPUT</literal></term>
@@ -191,6 +208,14 @@ ALTER FUNCTION sqrt(integer) RENAME TO square_root;
191208
<type>integer</type> to <literal>joe</literal>:
192209
<programlisting>
193210
ALTER FUNCTION sqrt(integer) OWNER TO joe;
211+
</programlisting>
212+
</para>
213+
214+
<para>
215+
To change the schema of the function <literal>sqrt</literal> for type
216+
<type>integer</type> to <literal>maths</literal>:
217+
<programlisting>
218+
ALTER FUNCTION sqrt(integer) SET SCHEMA maths;
194219
</programlisting>
195220
</para>
196221
</refsect1>
@@ -203,7 +228,7 @@ ALTER FUNCTION sqrt(integer) OWNER TO joe;
203228
FUNCTION</> statement in the SQL standard. The standard allows more
204229
properties of a function to be modified, but does not provide the
205230
ability to rename a function, make a function a security definer,
206-
or change the owner or volatility of a function. The standard also
231+
or change the owner, schema, or volatility of a function. The standard also
207232
requires the <literal>RESTRICT</> key word; it is optional in
208233
<productname>PostgreSQL</>.
209234
</para>

‎doc/src/sgml/ref/alter_sequence.sgml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.9 2004/11/27 21:27:07 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.10 2005/08/01 16:11:14 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -27,6 +27,7 @@ PostgreSQL documentation
2727
ALTER SEQUENCE <replaceable class="parameter">name</replaceable> [ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ]
2828
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ]
2929
[ RESTART [ WITH ] <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
30+
ALTER SEQUENCE <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
3031
</synopsis>
3132
</refsynopsisdiv>
3233

@@ -35,8 +36,14 @@ ALTER SEQUENCE <replaceable class="parameter">name</replaceable> [ INCREMENT [ B
3536

3637
<para>
3738
<command>ALTER SEQUENCE</command> changes the parameters of an existing
38-
sequence generator. Any parameter not specifically set in the
39-
<command>ALTER SEQUENCE</command> command retains its prior setting.
39+
sequence generator. Any parameters not specifically set in the
40+
<command>ALTER SEQUENCE</command> command retain their prior settings.
41+
</para>
42+
43+
<para>
44+
You must own the sequence to use <command>ALTER SEQUENCE</>.
45+
To change a sequence's schema, you must also have <literal>CREATE</>
46+
privilege on the new schema.
4047
</para>
4148
</refsect1>
4249

@@ -155,6 +162,15 @@ ALTER SEQUENCE <replaceable class="parameter">name</replaceable> [ INCREMENT [ B
155162
</para>
156163
</listitem>
157164
</varlistentry>
165+
166+
<varlistentry>
167+
<term><replaceable class="parameter">new_schema</replaceable></term>
168+
<listitem>
169+
<para>
170+
The new schema for the sequence.
171+
</para>
172+
</listitem>
173+
</varlistentry>
158174
</variablelist>
159175
</para>
160176
</refsect1>
@@ -186,14 +202,22 @@ ALTER SEQUENCE serial RESTART WITH 105;
186202
values. They will use up all cached values prior to noticing the changed
187203
sequence parameters. The current backend will be affected immediately.
188204
</para>
205+
206+
<para>
207+
Some variants of <command>ALTER TABLE</command> can be used with
208+
sequences as well; for example, to rename a sequence use <command>ALTER
209+
TABLE RENAME</command>.
210+
</para>
189211
</refsect1>
190212

191213

192214
<refsect1>
193215
<title>Compatibility</title>
194216

195217
<para>
196-
<command>ALTER SEQUENCE</command> conforms with <acronym>SQL:2003</acronym>.
218+
<command>ALTER SEQUENCE</command> conforms with <acronym>SQL:2003</acronym>,
219+
except for the <literal>SET SCHEMA</literal> variant, which is a
220+
<productname>PostgreSQL</productname> extension.
197221
</para>
198222
</refsect1>
199223
</refentry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp