DROP TABLESPACE
Description
Deletes a tablespace.
Precautions
- Only the tablespace owner or a user granted the DROP permission can run the DROP TABLESPACE command. The system administrator has this permission by default.
- The tablespace to be deleted should not contain any database objects. Otherwise, an error will be reported.
- DROP TABLESPACE cannot be rolled back and therefore cannot be run in transaction blocks.
- During execution of DROP TABLESPACE, database queries by other sessions using \db may fail and need to be reattempted.
- If DROP TABLESPACE fails to be executed, execute DROP TABLESPACE IF EXISTS.
Syntax
DROP TABLESPACE [ IF EXISTS ] tablespace_name;
Parameters
- IF EXISTS
Reports a notice instead of an error if the specified tablespace does not exist.
- tablespace_name
Specifies the name of the tablespace to be deleted.
Value range: an existing tablespace name
Examples
1 2 3 4 5 |
-- Create a tablespace. gaussdb=# CREATE TABLESPACE tbs_location1 RELATIVE LOCATION 'test_tablespace/test_tablespace_1'; -- Drop the tablespace. gaussdb=# DROP TABLESPACE tbs_location1; |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.