PostgreSQL

Скачать в pdf «PostgreSQL»


Description


DROP TABLE removes tables and views from the database. Only its owner may destroy a table or view. A table may be emptied of rows, but not destroyed, by using DELETE.


If a table being destroyed has secondary indexes on it, they will be removed first. The removal of just a secondary index will not affect the contents of the underlying table.


Notes


Refer to CREATE TABLE and ALTER TABLE for information on how to create or modify tables.


Usage


To destroy two tables, films and distributors:


DROP TABLE films, distributors;


Compatibility


SQL92


SQL92 specifies some additional capabilities for DROP TABLE:


DROP TABLE table { RESTRICT | CASCADE }


RESTRICT Ensures that only a table with no dependent views or integrity constraints can be destroyed.


CASCADE Any referencing views or integrity constraints will also be dropped.


Tip: At present, to remove a referenced view you must drop it explicitly.

D.42 DROP TRIGGER


Name


DROP TRIGGER — Removes the definition of a trigger DROP TRIGGER name ON table


Inputs


name The name of an existing trigger. table The name of a table.


Outputs


DROP The message returned if the trigger is successfully dropped.


ERROR: DropTrigger: there is no trigger name on relation «table» This message occurs if the trigger specified does not exist.


Description


DROP TRIGGER will remove all references to an existing trigger definition. To execute this command the current user must be the owner of the trigger.

Скачать в pdf «PostgreSQL»