DROP TABLESPACE is a DDL command for removing a tablespace.
DROP TABLESPACE was added in PostgreSQL 8.0.
DROP TABLESPACE can only be executed if the tablespace contains no objects from any database. For this reason, there is no
DROP TABLESPACE ... CASCADE option, as it is not possible for commands in one database to selectively manipulate objects in another database.
The system function
pg_tablespace_databases() can be used verify if a tablespace contains any objects, and if so which databases they belong to. See that function's examples section for a sample query.
Attempting to drop a tablespace which still contains objects:
postgres=# DROP TABLESPACE tblspace_1; ERROR: tablespace "tblspace_1" is not empty
Dropping an empty tablespace:
postgres=# DROP TABLESPACE tblspace_2; DROP TABLESPACE