aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-04-01 04:35:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-04-01 04:35:40 +0000
commit9b77f6193058d84adee26a3ec0c50a99e443ae92 (patch)
treebebbba40230ed0774b3c3cc31f5866d7ede43763 /doc/src
parent838fe25a9532ab2e9b9b7517fec94e804cf3da81 (diff)
downloadpostgresql-9b77f6193058d84adee26a3ec0c50a99e443ae92.tar.gz
postgresql-9b77f6193058d84adee26a3ec0c50a99e443ae92.zip
ALTER TABLE SET/DROP NOT NULL, from Christopher Kings-Lynne.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/alter_table.sgml18
-rw-r--r--doc/src/sgml/release.sgml3
2 files changed, 19 insertions, 2 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index da6e91bf4d3..4423d8b2ed8 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.40 2002/03/06 20:42:38 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.41 2002/04/01 04:35:37 tgl Exp $
PostgreSQL documentation
-->
@@ -29,6 +29,8 @@ ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET DEFAULT <replaceable
class="PARAMETER">value</replaceable> | DROP DEFAULT }
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
+ ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET | DROP } NOT NULL
+ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STATISTICS <replaceable class="PARAMETER">integer</replaceable>
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN}
@@ -168,6 +170,9 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
allow you to set or remove the default for the column. Note that defaults
only apply to subsequent <command>INSERT</command> commands; they do not
cause rows already in the table to change.
+ The <literal>ALTER COLUMN SET/DROP NOT NULL</literal> forms allow you to
+ change whether a column is marked to allow NULL values or to reject NULL
+ values.
The <literal>ALTER COLUMN SET STATISTICS</literal> form allows you to
set the statistics-gathering target for subsequent
<xref linkend="sql-analyze" endterm="sql-analyze-title"> operations.
@@ -279,6 +284,17 @@ ALTER TABLE distributors RENAME TO suppliers;
</programlisting>
</para>
+ <para>
+ To add a NOT NULL constraint to a column:
+ <programlisting>
+ALTER TABLE distributors ALTER COLUMN street SET NOT NULL;
+ </programlisting>
+ To remove a NOT NULL constraint from a column:
+ <programlisting>
+ALTER TABLE distributors ALTER COLUMN street DROP NOT NULL;
+ </programlisting>
+ </para>
+
<para>
To add a check constraint to a table:
<programlisting>
diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml
index 5c2c859acb0..c3e52dd948b 100644
--- a/doc/src/sgml/release.sgml
+++ b/doc/src/sgml/release.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.128 2002/03/25 21:24:08 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.129 2002/04/01 04:35:37 tgl Exp $
-->
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
worries about funny characters.
-->
<literallayout><![CDATA[
+ALTER TABLE ALTER COLUMN SET/DROP NOT NULL
EXPLAIN output comes out as a query result, not a NOTICE message
DOMAINs (types that are constrained versions of base types)
Access privileges on functions