From 39d74e346c083aa371ba64c4edb1332c40b56530 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 10 Mar 2012 20:19:13 +0200 Subject: Add support for renaming constraints reviewed by Josh Berkus and Dimitri Fontaine --- doc/src/sgml/ref/alter_table.sgml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 951b63b5b4f..c3039c81672 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -25,6 +25,8 @@ ALTER TABLE [ IF EXISTS ] [ ONLY ] nameaction [, ... ] ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] RENAME [ COLUMN ] column TO new_column +ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] + RENAME CONSTRAINT constraint_name TO new_constraint_name ALTER TABLE [ IF EXISTS ] name RENAME TO new_name ALTER TABLE [ IF EXISTS ] name @@ -569,8 +571,8 @@ ALTER TABLE [ IF EXISTS ] name The RENAME forms change the name of a table - (or an index, sequence, or view) or the name of an individual column in - a table. There is no effect on the stored data. + (or an index, sequence, or view), the name of an individual column in + a table, or the name of a constraint of the table. There is no effect on the stored data. @@ -883,7 +885,8 @@ ALTER TABLE [ IF EXISTS ] name If a table has any descendant tables, it is not permitted to add, - rename, or change the type of a column in the parent table without doing + rename, or change the type of a column, or rename an inherited constraint + in the parent table without doing the same to the descendants. That is, ALTER TABLE ONLY will be rejected. This ensures that the descendants always have columns matching the parent. @@ -982,6 +985,13 @@ ALTER TABLE distributors RENAME TO suppliers; + + To rename an existing constraint: + +ALTER TABLE distributors RENAME CONSTRAINT zipchk TO zip_check; + + + To add a not-null constraint to a column: -- cgit v1.2.3