DROP TABLESPACE
DROP TABLESPACE — Remove a tablespace
Synopsis
DROP TABLESPACE [ IF EXISTS ] name
Description
DROP TABLESPACE removes a tablespace from the system.
A tablespace can only be dropped by its owner or a superuser. Before a tablespace can be dropped, there must be no database objects in it. Even if no objects in the current database are using the tablespace, objects from other databases may still exist in it. Also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP may fail because temporary files may exist in it.
Parameters
IF EXISTS
Do not throw an error if the tablespace does not exist. A notice is issued in this case.
name
The name of a tablespace.
Notes
DROP TABLESPACE cannot be executed inside a transaction block.
Examples
# To remove the tablespace mystuff from the system:
DROP TABLESPACE mystuff;