DROP_TABLESPACE(7pg17)
π NAME π
okay so bestie, welcome to the DROP TABLESPACE(7) page from the PostgreSQL 17.11 Documentation β and it's literally about removing a tablespace. periodt. β¨
β¨ SYNOPSIS β¨
DROP TABLESPACE [ IF EXISTS ] name
π¦ DESCRIPTION π¦
So DROP TABLESPACE removes a tablespace from the system. iconic behavior, honestly. π
A tablespace can only be dropped by its owner or a superuser. no cap. π«Ά
Bestie, listen: the tablespace has to be empty of all database objects before it can be dropped. and the way that other databases can still have objects chilling in there even if nothing in the current database is using it? yeah. π it's possible that objects in other databases might still reside in the tablespace even if no objects in the current database are using the tablespace.
Also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP might fail because of temporary files residing in the tablespace. so keep that in mind, fr fr. πΈ
π PARAMETERS π
IF EXISTSβ don't throw an error if the tablespace does not exist. a notice is issued in this case instead. πnameβ the name of a tablespace. that's the one, bestie. π¦
π₯ NOTES π₯
DROP TABLESPACE cannot be executed inside a transaction block. literally cannot. don't try it, bestie. π
π EXAMPLES π
To remove tablespace mystuff from the system:
DROP TABLESPACE mystuff;
β COMPATIBILITY β
DROP TABLESPACE is a PostgreSQL extension. that's the whole vibe. π
π§ SEE ALSO π§
CREATE TABLESPACE (CREATE_TABLESPACE(7))ALTER TABLESPACE (ALTER_TABLESPACE(7))
signed, sealed, and slaying at the very end: this page is from PostgreSQL 17.11, dated 2026, and it's the DROP TABLESPACE(7) manual page. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms