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

Commitf947bbb

Browse files
committed
Attached is are diffs for CREATE/ALTER table doc I've
forgotten in my mailbox (sorry). Haven't tried to apply and since I don't have working sgml stuff cannot check.Jan
1 parentbdf6c4f commitf947bbb

File tree

4 files changed

+604
-11
lines changed

4 files changed

+604
-11
lines changed

‎doc/src/FAQ.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ <H4><A
181181
functionality was added in 1995, its name was changed to Postgres95. The
182182
name was changed at the end of 1996 to PostgreSQL.<P>
183183

184+
It is pronounced<I>Post-Gres-Q-L.</I>
185+
184186
<H4><ANAME="1.2">1.2</A>)What's the copyright on
185187
PostgreSQL?</H4><P>
186188

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

Lines changed: 36 additions & 7 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.11 2000/03/27 17:14:42 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.12 2000/04/1114:43:54 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -34,6 +34,8 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable> [ * ]
3434
class="PARAMETER">newcolumn</replaceable>
3535
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
3636
RENAME TO <replaceable class="PARAMETER">newtable</replaceable>
37+
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
38+
ADD <replaceable class="PARAMETER">table constraint definition</replaceable>
3739
</synopsis>
3840

3941
<refsect2 id="R2-SQL-ALTERTABLE-1">
@@ -89,6 +91,15 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
8991
</para>
9092
</listitem>
9193
</varlistentry>
94+
95+
<varlistentry>
96+
<term><replaceable class="PARAMETER"> table constraint definition </replaceable></term>
97+
<listitem>
98+
<para>
99+
New table constraint for the table
100+
</para>
101+
</listitem>
102+
</varlistentry>
92103
</variablelist>
93104
</para>
94105
</refsect2>
@@ -144,6 +155,9 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
144155
the affected table. Thus, the table or column will
145156
remain of the same type and size after this command is
146157
executed.
158+
The ADD <replaceable class="PARAMETER">table constraint definition</replaceable> clause
159+
adds a new constraint to the table using the same syntax as <xref
160+
linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-title">.
147161
</para>
148162

149163
<para>
@@ -188,6 +202,16 @@ SELECT <replaceable>NewColumn</replaceable> FROM <replaceable>SuperClass</replac
188202
endterm="sql-update-title">.)
189203
</para>
190204

205+
<para>
206+
In the current implementation, only FOREIGN KEY constraints can
207+
be added to a table. To create or remove a unique constraint, create
208+
a unique index (see <xref linkend="SQL-CREATEINDEX"
209+
endterm="SQL-CREATEINDEX-title">). To add check constraints
210+
you need to recreate and reload the table, using other
211+
parameters to the <xref linkend="SQL-CREATETABLE"
212+
endterm="SQL-CREATETABLE-title"> command.
213+
</para>
214+
191215
<para>
192216
You must own the class in order to change its schema.
193217
Renaming any part of the schema of a system
@@ -227,6 +251,13 @@ ALTER TABLE distributors RENAME COLUMN address TO city;
227251
ALTER TABLE distributors RENAME TO suppliers;
228252
</programlisting>
229253
</para>
254+
255+
<para>
256+
To add a foreign key constraint to a table:
257+
<programlisting>
258+
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses(address) MATCH FULL
259+
</programlisting>
260+
</para>
230261
</refsect1>
231262

232263
<refsect1 id="R1-SQL-ALTERTABLE-3">
@@ -253,17 +284,15 @@ ALTER TABLE distributors RENAME TO suppliers;
253284
<varlistentry>
254285
<term>
255286
<synopsis>
256-
ALTER TABLE <replaceable class="PARAMETER">table</replaceable> ADD <replaceable class="PARAMETER">table constraint definition</replaceable>
257287
ALTER TABLE <replaceable class="PARAMETER">table</replaceable> DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> { RESTRICT | CASCADE }
258288
</synopsis>
259289
</term>
260290
<listitem>
261291
<para>
262-
Adds or removes a table constraint (such as a check constraint,
263-
unique constraint, or foreign key constraint). To create
264-
or remove a unique constraint, create or drop a unique index,
265-
respectively (see <xref linkend="SQL-CREATEINDEX" endterm="SQL-CREATEINDEX-title">).
266-
To change other kinds of constraints you need to recreate
292+
Removes a table constraint (such as a check constraint,
293+
unique constraint, or foreign key constraint). To
294+
remove a unique constraint, drop a unique index,
295+
To remove other kinds of constraints you need to recreate
267296
and reload the table, using other parameters to the
268297
<xref linkend="SQL-CREATETABLE" endterm="SQL-CREATETABLE-title">
269298
command.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp