endterm="SQL-CREATEINDEX-title">).
+ Currently only CHECK constraints can be dropped from a table. The RESTRICT
+ keyword is required, although dependencies are not checked. The CASCADE
+ option is unsupported. To remove a PRIMARY or UNIQUE constraint, drop the
+ relevant index using the command.
+ To remove FOREIGN KEY constraints you need to recreate
+ and reload the table, using other parameters to the
+
+ command.
+
+ For example, to drop all constraints on a table distributors:
+CREATE TABLE temp AS SELECT * FROM distributors;
+DROP TABLE distributors;
+CREATE TABLE distributors AS SELECT * FROM temp;
+DROP TABLE temp;
+
+
+
You must own the table in order to change it.
Changing any part of the schema of a system
+ To remove a check constraint from a table and all its children:
+ALTER TABLE distributors DROP CONSTRAINT zipchk
+
+
+
To add a foreign key constraint to a table:
statement which are not yet directly supported by
Postgres:
-
-
-
-ALTER TABLE table DROP CONSTRAINT constraint { RESTRICT | CASCADE }
-
-
-
- Removes a table constraint (such as a check constraint,
- unique constraint, or foreign key constraint). To
- remove a unique constraint, drop a unique index.
- To remove other kinds of constraints you need to recreate
- and reload the table, using other parameters to the
-
- command.
-
- For example, to drop any constraints on a table distributors:
-CREATE TABLE temp AS SELECT * FROM distributors;
-DROP TABLE distributors;
-CREATE TABLE distributors AS SELECT * FROM temp;
-DROP TABLE temp;
-
-
-
-
-