Book Contents

Book Index

Next Topic

Home

DROP TABLE

Drops a table and optionally its associated projections.

Syntax

DROP TABLE table [ CASCADE ]

Semantics

table

specifies the name of a schema table

CASCADE

drops all projections that include the table.

Warning: dropping a table and its associated projections is very likely to destroy the K-Safety of your physical schema design. Use this command only when absolutely necessary.

if you try to drop an table that has associated projections, you will get a message listing the projections. For example:

=> DROP TABLE d1;

NOTICE: Constraint - depends on Table d1

NOTICE: Projection d1p1 depends on Table d1

NOTICE: Projection d1p2 depends on Table d1

NOTICE: Projection d1p3 depends on Table d1

NOTICE: Projection f1d1p1 depends on Table d1

NOTICE: Projection f1d1p2 depends on Table d1

NOTICE: Projection f1d1p3 depends on Table d1

ERROR: DROP failed due to dependencies: Cannot drop Table d1 because other objects depend on it

HINT: Use DROP ... CASCADE to drop the dependent objects too.

Notes

SQL Language References

PostgreSQL 8.0.12 Documentation

BNF Grammar for SQL-99