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

Commit0c1fe3d

Browse files
committed
Update SQL-command reference pages for schema features.
1 parent5dd1c71 commit0c1fe3d

38 files changed

+366
-205
lines changed

‎doc/src/sgml/ref/alter_database.sgml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.1 2002/03/01 22:45:07 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.2 2002/04/23 02:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -28,15 +28,16 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replacea
2828
<command>ALTER DATABASE</command> is used to change the session
2929
default of a run-time configuration variable for a
3030
<productname>PostgreSQL</productname> database. Whenever a new
31-
session is subsequently started, <literal>SET
31+
session is subsequently started in that database, <literal>SET
3232
<replaceable>variable</replaceable> TO
3333
<replaceable>value</replaceable></literal> is effectively executed
34-
before the start of the session.
34+
before the start of the session. The database-specific default
35+
overrides whatever setting is present in <filename>postgresql.conf</>
36+
or has been received from the postmaster.
3537
</para>
3638

3739
<para>
38-
Only a database owner can change the session defaults for a
39-
database. Superusers can change the session defaults of any
40+
Only a superuser or the database owner can change the session defaults for a
4041
database.
4142
</para>
4243

@@ -113,7 +114,8 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replacea
113114
<para>
114115
Using <xref linkend="sql-alteruser" endterm="sql-alteruser-title">,
115116
it is also possible to tie a session default to a specific user
116-
rather than a database.
117+
rather than a database. User-specific settings override database-specific
118+
ones if there is a conflict.
117119
</para>
118120
</refsect1>
119121

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 141 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.42 2002/04/21 19:02:39 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.43 2002/04/2302:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -24,23 +24,22 @@ PostgreSQL documentation
2424
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
2525
ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable> [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
2626
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
27-
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET DEFAULT <replaceable
28-
class="PARAMETER">value</replaceable> | DROP DEFAULT }
27+
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET DEFAULT <replaceable class="PARAMETER">value</replaceable> | DROP DEFAULT }
2928
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
3029
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET | DROP } NOT NULL
3130
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
3231
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STATISTICS <replaceable class="PARAMETER">integer</replaceable>
3332
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
34-
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN}
33+
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN}
3534
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
3635
RENAME [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> TO <replaceable
37-
class="PARAMETER">newcolumn</replaceable>
36+
class="PARAMETER">new_column</replaceable>
3837
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
3938
RENAME TO <replaceable class="PARAMETER">new_table</replaceable>
4039
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4140
ADD <replaceable class="PARAMETER">table_constraint_definition</replaceable>
4241
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable>
43-
DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> { RESTRICT | CASCADE }
42+
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> { RESTRICT | CASCADE }
4443
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4544
OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
4645
</synopsis>
@@ -58,7 +57,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
5857
<term><replaceable class="PARAMETER"> table </replaceable></term>
5958
<listitem>
6059
<para>
61-
The name of an existing table to alter.
60+
The name(possibly schema-qualified)of an existing table to alter.
6261
</para>
6362
</listitem>
6463
</varlistentry>
@@ -82,7 +81,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
8281
</varlistentry>
8382

8483
<varlistentry>
85-
<term><replaceable class="PARAMETER">newcolumn </replaceable></term>
84+
<term><replaceable class="PARAMETER">new_column </replaceable></term>
8685
<listitem>
8786
<para>
8887
New name for an existing column.
@@ -103,7 +102,16 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
103102
<term><replaceable class="PARAMETER"> table_constraint_definition </replaceable></term>
104103
<listitem>
105104
<para>
106-
New table constraint for the table
105+
New table constraint for the table.
106+
</para>
107+
</listitem>
108+
</varlistentry>
109+
110+
<varlistentry>
111+
<term><replaceable class="PARAMETER"> constraint_name </replaceable></term>
112+
<listitem>
113+
<para>
114+
Name of an existing constraint to drop.
107115
</para>
108116
</listitem>
109117
</varlistentry>
@@ -162,44 +170,124 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
162170
</title>
163171
<para>
164172
<command>ALTER TABLE</command> changes the definition of an existing table.
165-
The <literal>ADD COLUMN</literal> form adds a new column to the table
166-
using the same syntax as <xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">.
167-
The <literal>ALTER COLUMN SET/DROP DEFAULT</literal> forms
168-
allow you to set or remove the default for the column. Note that defaults
169-
only apply to subsequent <command>INSERT</command> commands; they do not
170-
cause rows already in the table to change.
171-
The <literal>ALTER COLUMN SET/DROP NOT NULL</literal> forms allow you to
172-
change whether a column is marked to allow NULL values or to reject NULL
173-
values.
174-
The <literal>ALTER COLUMN SET STATISTICS</literal> form allows you to
175-
set the statistics-gathering target for subsequent
176-
<xref linkend="sql-analyze" endterm="sql-analyze-title"> operations.
177-
The <literal>ALTER COLUMN SET STORAGE</literal> form allows the
178-
column storage mode to be set. This controls whether this column is
179-
held inline or in a supplementary table, and whether the data
180-
should be compressed or not. <literal>PLAIN</literal> must be used
181-
for fixed-length values such as <literal>INTEGER</literal> and is
182-
inline, uncompressed. <literal>MAIN</literal> is for inline,
183-
compressible data. <literal>EXTERNAL</literal> is for external,
184-
uncompressed data and <literal>EXTENDED</literal> is for external,
185-
compressed data. The use of <literal>EXTERNAL</literal> will make
186-
substring operations on a column faster, at the penalty of
187-
increased storage space.
188-
The <literal>RENAME</literal> clause causes the name of a table,
189-
column, index, sequence or view to change without changing any of the
190-
data. The data will remain of the same type and size after the
191-
command is executed.
192-
The ADD <replaceable class="PARAMETER">table_constraint_definition</replaceable> clause
193-
adds a new constraint to the table using the same syntax as <xref
194-
linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">.
195-
The DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> clause
196-
drops all constraints on the table (and its children) that match <replaceable class="PARAMETER">constraint</replaceable>.
197-
The OWNER clause changes the owner of the table, index, sequence or view to the
198-
user <replaceable class="PARAMETER">new user</replaceable>.
173+
There are several sub-forms:
199174
</para>
200175

176+
<variablelist>
177+
178+
<varlistentry>
179+
<term>ADD COLUMN</term>
180+
<listitem>
181+
<para>
182+
This form adds a new column to the table using the same syntax as
183+
<xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">.
184+
</para>
185+
</listitem>
186+
</varlistentry>
187+
188+
<varlistentry>
189+
<term>SET/DROP DEFAULT</term>
190+
<listitem>
191+
<para>
192+
These forms set or remove the default value for a column. Note
193+
that defaults only apply to subsequent <command>INSERT</command>
194+
commands; they do not cause rows already in the table to change.
195+
Defaults may also be created for views, in which case they are
196+
inserted into <command>INSERT</> statements on the view before
197+
the view's ON INSERT rule is applied.
198+
</para>
199+
</listitem>
200+
</varlistentry>
201+
202+
<varlistentry>
203+
<term>SET/DROP NOT NULL</term>
204+
<listitem>
205+
<para>
206+
These forms change whether a column is marked to allow NULL
207+
values or to reject NULL values. You may only <literal>SET NOT NULL</>
208+
when the table contains no NULLs in the column.
209+
</para>
210+
</listitem>
211+
</varlistentry>
212+
213+
<varlistentry>
214+
<term>SET STATISTICS</term>
215+
<listitem>
216+
<para>
217+
This form
218+
sets the per-column statistics-gathering target for subsequent
219+
<xref linkend="sql-analyze" endterm="sql-analyze-title"> operations.
220+
</para>
221+
</listitem>
222+
</varlistentry>
223+
224+
<varlistentry>
225+
<term>SET STORAGE</term>
226+
<listitem>
227+
<para>
228+
This form sets the storage mode for a column. This controls whether this
229+
column is held inline or in a supplementary table, and whether the data
230+
should be compressed or not. <literal>PLAIN</literal> must be used
231+
for fixed-length values such as <literal>INTEGER</literal> and is
232+
inline, uncompressed. <literal>MAIN</literal> is for inline,
233+
compressible data. <literal>EXTERNAL</literal> is for external,
234+
uncompressed data and <literal>EXTENDED</literal> is for external,
235+
compressed data. <literal>EXTENDED</literal> is the default for all
236+
datatypes that support it. The use of <literal>EXTERNAL</literal> will
237+
make substring operations on a TEXT column faster, at the penalty of
238+
increased storage space.
239+
</para>
240+
</listitem>
241+
</varlistentry>
242+
243+
<varlistentry>
244+
<term>RENAME</term>
245+
<listitem>
246+
<para>
247+
The <literal>RENAME</literal> forms change the name of a table
248+
(or an index, sequence, or view) or the name of an individual column in
249+
a table. There is no effect on the stored data.
250+
</para>
251+
</listitem>
252+
</varlistentry>
253+
254+
<varlistentry>
255+
<term>ADD <replaceable class="PARAMETER">table_constraint_definition</replaceable></term>
256+
<listitem>
257+
<para>
258+
This form adds a new constraint to a table using the same syntax as
259+
<xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-TITLE">.
260+
</para>
261+
</listitem>
262+
</varlistentry>
263+
264+
<varlistentry>
265+
<term>DROP CONSTRAINT</term>
266+
<listitem>
267+
<para>
268+
This form drops constraints on a table (and its children).
269+
Currently, constraints on tables are not required to have unique
270+
names, so there may be more than one constraint matching the specified
271+
name. All such constraints will be dropped.
272+
</para>
273+
</listitem>
274+
</varlistentry>
275+
276+
<varlistentry>
277+
<term>OWNER</term>
278+
<listitem>
279+
<para>
280+
This form changes the owner of the table, index, sequence or view to the
281+
specified user.
282+
</para>
283+
</listitem>
284+
</varlistentry>
285+
286+
</variablelist>
287+
201288
<para>
202-
You must own the table in order to change its schema.
289+
You must own the table to use <command>ALTER TABLE</>; except for
290+
<command>ALTER TABLE OWNER</>, which may only be executed by a superuser.
203291
</para>
204292

205293
<refsect2 id="R2-SQL-ALTERTABLE-3">
@@ -216,16 +304,20 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
216304
<para>
217305
In the current implementation of <literal>ADD COLUMN</literal>,
218306
default and NOT NULL clauses for the new column are not supported.
307+
The new column always comes into being with all values NULL.
219308
You can use the <literal>SET DEFAULT</literal> form
220-
of <command>ALTER TABLE</command> to set the defaultlater.
309+
of <command>ALTER TABLE</command> to set the defaultafterwards.
221310
(You may also want to update the already existing rows to the
222-
new default value, using <xref linkend="sql-update" endterm="sql-update-title">.)
311+
new default value, using
312+
<xref linkend="sql-update" endterm="sql-update-title">.)
313+
If you want to mark the column non-null, use the <literal>SET NOT NULL</>
314+
form after you've entered non-null values for the column in all rows.
223315
</para>
224316

225317
<para>
226318
In DROP CONSTRAINT, the RESTRICT keyword is required, although
227319
dependencies are not yet checked. The CASCADE option is unsupported.
228-
Currently DROP CONSTRAINTdropsonly CHECK constraints.
320+
Currently DROP CONSTRAINT only handles CHECK constraints.
229321
To remove a PRIMARY or UNIQUE constraint, drop the
230322
relevant index using the <xref linkend="SQL-DROPINDEX" endterm="sql-dropindex-title"> command.
231323
To remove FOREIGN KEY constraints you need to recreate
@@ -243,16 +335,15 @@ DROP TABLE temp;
243335
</para>
244336

245337
<para>
246-
You must own the table in order to change it.
247338
Changing any part of the schema of a system
248339
catalog is not permitted.
249-
The <citetitle>PostgreSQL User's Guide</citetitle> has further
250-
information on inheritance.
251340
</para>
252341

253342
<para>
254343
Refer to <command>CREATE TABLE</command> for a further description
255344
of valid arguments.
345+
The <citetitle>PostgreSQL User's Guide</citetitle> has further
346+
information on inheritance.
256347
</para>
257348
</refsect2>
258349
</refsect1>

‎doc/src/sgml/ref/analyze.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/analyze.sgml,v 1.7 2002/04/21 19:02:39 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/analyze.sgml,v 1.8 2002/04/2302:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -46,7 +46,8 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ (<rep
4646
<term><replaceable class="PARAMETER">table</replaceable></term>
4747
<listitem>
4848
<para>
49-
The name of a specific table to analyze. Defaults to all tables.
49+
The name (possibly schema-qualified) of a specific table to
50+
analyze. Defaults to all tables in the current database.
5051
</para>
5152
</listitem>
5253
</varlistentry>

‎doc/src/sgml/ref/cluster.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.15 2002/04/21 19:02:39 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.16 2002/04/2302:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -46,7 +46,7 @@ CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable c
4646
<term><replaceable class="PARAMETER">table</replaceable></term>
4747
<listitem>
4848
<para>
49-
The name of a table.
49+
The name(possibly schema-qualified)of a table.
5050
</para>
5151
</listitem>
5252
</varlistentry>

‎doc/src/sgml/ref/comment.sgml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.17 2002/04/21 19:02:39 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.18 2002/04/2302:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -44,11 +44,13 @@ COMMENT ON
4444

4545
<variablelist>
4646
<varlistentry>
47-
<term><replaceable class="PARAMETER">object_name, table_name,
48-
column_name, agg_name, func_name, op, rule_name, trigger_name</replaceable></term>
47+
<term><replaceable class="PARAMETER">object_name,
48+
table_name.column_name, agg_name, func_name, op, rule_name, trigger_name</replaceable></term>
4949
<listitem>
5050
<para>
51-
The name of the object to be be commented.
51+
The name of the object to be be commented. Names of tables,
52+
indexes, sequences, views, types, domains, functions, aggregates,
53+
and operators may be schema-qualified.
5254
</para>
5355
</listitem>
5456
</varlistentry>

‎doc/src/sgml/ref/copy.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.29 2002/03/22 19:20:37 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.30 2002/04/23 02:07:15 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -56,7 +56,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
5656
<term><replaceable class="parameter">table</replaceable></term>
5757
<listitem>
5858
<para>
59-
The name of an existing table.
59+
The name(possibly schema-qualified)of an existing table.
6060
</para>
6161
</listitem>
6262
</varlistentry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp