aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-10-12 00:07:15 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-10-12 00:07:15 +0000
commitf9e6e27c873bcf50fdc20f5a28c5bede66d18f25 (patch)
treef6514d7b7c968982c25b00008c43289c6e2df1e1 /doc/src
parente98476eb032bd4dc32ca97212b660cad0bbadef4 (diff)
downloadpostgresql-f9e6e27c873bcf50fdc20f5a28c5bede66d18f25.tar.gz
postgresql-f9e6e27c873bcf50fdc20f5a28c5bede66d18f25.zip
Break transformCreateStmt() into multiple routines and make
transformAlterStmt() use these routines, instead of having lots of duplicate (not to mention should-have-been-duplicate) code. Adding a column with a CHECK constraint actually works now, and the tests to reject unsupported DEFAULT and NOT NULL clauses actually fire now. ALTER TABLE ADD PRIMARY KEY works, modulo having to have created the column(s) NOT NULL already.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/alter_table.sgml20
1 files changed, 6 insertions, 14 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index e52dc252d93..f5ac58705b2 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.28 2001/09/12 02:13:25 ishii Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.29 2001/10/12 00:07:14 tgl Exp $
Postgres documentation
-->
@@ -24,8 +24,7 @@ Postgres documentation
</refsynopsisdivinfo>
<synopsis>
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
- ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable
- class="PARAMETER">type</replaceable>
+ ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable> [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET DEFAULT <replaceable
class="PARAMETER">value</replaceable> | DROP DEFAULT }
@@ -202,21 +201,14 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
<para>
In the current implementation of <literal>ADD COLUMN</literal>,
- default and constraint clauses for the
- new column will be ignored. You can use the <literal>SET DEFAULT</literal>
- form of <command>ALTER TABLE</command> to set the default later.
+ default and NOT NULL clauses for the new column are not supported.
+ You can use the <literal>SET DEFAULT</literal> form
+ of <command>ALTER TABLE</command> to set the default later.
(You may also want to update the already existing rows to the
new default value, using <xref linkend="sql-update"
endterm="sql-update-title">.)
</para>
- <para>
- In the current implementation, only UNIQUE, FOREIGN KEY and CHECK constraints can
- be added to a table. To create a primary constraint, create
- a unique, not null index (see <xref linkend="SQL-CREATEINDEX"
- endterm="SQL-CREATEINDEX-title">).
- </para>
-
<para>
Currently only CHECK constraints can be dropped from a table. The RESTRICT
keyword is required, although dependencies are not checked. The CASCADE
@@ -318,7 +310,7 @@ ALTER TABLE distributors ADD CONSTRAINT dist_id_zipcode_key UNIQUE (dist_id, zip
<title>SQL92</title>
<para>
The <literal>ADD COLUMN</literal> form is compliant with the exception that
- it does not support defaults and constraints, as explained above.
+ it does not support defaults and NOT NULL constraints, as explained above.
The <literal>ALTER COLUMN</literal> form is in full compliance.
</para>