11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.50 2002/09/21 18:32:54 petere Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.51 2002/10/19 22:51:45 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -38,9 +38,9 @@ ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
3838 class="PARAMETER">new_column</replaceable>
3939ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4040 RENAME TO <replaceable class="PARAMETER">new_table</replaceable>
41- ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
42- ADD <replaceable class="PARAMETER">table_constraint_definition </replaceable>
43- ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable>
41+ ALTER TABLE[ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
42+ ADD <replaceable class="PARAMETER">table_constraint </replaceable>
43+ ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable>[ * ]
4444DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> [ RESTRICT | CASCADE ]
4545ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4646OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
@@ -110,7 +110,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
110110 </varlistentry>
111111
112112 <varlistentry>
113- <term><replaceable class="PARAMETER">table_constraint_definition </replaceable></term>
113+ <term><replaceable class="PARAMETER">table_constraint </replaceable></term>
114114 <listitem>
115115 <para>
116116New table constraint for the table.
@@ -298,7 +298,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
298298 </varlistentry>
299299
300300 <varlistentry>
301- <term>ADD <replaceable class="PARAMETER">table_constraint_definition </replaceable></term>
301+ <term>ADD <replaceable class="PARAMETER">table_constraint </replaceable></term>
302302 <listitem>
303303 <para>
304304 This form adds a new constraint to a table using the same syntax as
@@ -311,7 +311,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
311311 <term>DROP CONSTRAINT</term>
312312 <listitem>
313313 <para>
314- This form drops constraints on a table (and its children) .
314+ This form drops constraints on a table.
315315 Currently, constraints on tables are not required to have unique
316316 names, so there may be more than one constraint matching the specified
317317 name. All such constraints will be dropped.
@@ -376,6 +376,22 @@ VACUUM FULL table;
376376 </programlisting>
377377 </para>
378378
379+ <para>
380+ If a table has any descendant tables, it is not permitted to ADD or
381+ RENAME a column in the parent table without doing the same to the
382+ descendants --- that is, ALTER TABLE ONLY will be rejected. This
383+ ensures that the descendants always have columns matching the parent.
384+ </para>
385+
386+ <para>
387+ A recursive DROP COLUMN operation will remove a descendant table's column
388+ only if the descendant does not inherit that column from any other
389+ parents and never had an independent definition of the column.
390+ A nonrecursive DROP COLUMN (i.e., ALTER TABLE ONLY ... DROP COLUMN)
391+ never removes any descendant columns, but instead marks them as
392+ independently defined rather than inherited.
393+ </para>
394+
379395 <para>
380396 Changing any part of the schema of a system
381397 catalog is not permitted.