From f9e6e27c873bcf50fdc20f5a28c5bede66d18f25 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 12 Oct 2001 00:07:15 +0000 Subject: 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. --- doc/src/sgml/ref/alter_table.sgml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'doc/src') 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 @@ @@ -24,8 +24,7 @@ Postgres documentation ALTER TABLE [ ONLY ] table [ * ] - ADD [ COLUMN ] column type + ADD [ COLUMN ] column type [ column_constraint [ ... ] ] ALTER TABLE [ ONLY ] table [ * ] ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT } @@ -202,21 +201,14 @@ ALTER TABLE table In the current implementation of ADD COLUMN, - default and constraint clauses for the - new column will be ignored. You can use the SET DEFAULT - form of ALTER TABLE to set the default later. + default and NOT NULL clauses for the new column are not supported. + You can use the SET DEFAULT form + of ALTER TABLE to set the default later. (You may also want to update the already existing rows to the new default value, using .) - - 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 ). - - 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 SQL92 The ADD COLUMN 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 ALTER COLUMN form is in full compliance. -- cgit v1.2.3