DROP_TABLESPACE(7pg15)
π DROP_TABLESPACE β the "bye bestie" page for tablespaces β¨
okay so real talk: this is the DROP TABLESPACE page from the PostgreSQL 15.19 Documentation (yes, the 7pg15 one, you found it π«Ά). It's short, it's sweet, and it's giving "cleanup era." Let's get into it πΈ
β¨ NAME β¨
DROP TABLESPACE β literally just remove a tablespace. that's the whole vibe. π
π¦ SYNOPSIS π¦
DROP TABLESPACE [ IF EXISTS ] name
look at her. so compact. so powerful. π
π DESCRIPTION π
DROP TABLESPACE removes a tablespace from the system. periodt. π
Now the important bits, bestie, don't skip these:
- Only the owner of the tablespace or a superuser can drop it. so like, know your lane π
- The tablespace must be empty of all database objects before it can be dropped. no objects, no problem. objects = blocked.
- Sneaky detail: it's possible that objects in other databases might still reside in the tablespace even if no objects in the current database are using it. so it can look empty from where you're standing and still not be. the audacity π
- Also β and this one gets people β if the tablespace is listed in the
temp_tablespacessetting of any active session, theDROPmight fail because of temporary files residing in the tablespace. temp files said "we live here now" π
π PARAMETERS π
IF EXISTSβ do not throw an error if the tablespace does not exist. instead a notice is issued in this case. very "no harm no foul" of it πnameβ the name of a tablespace. that's it, that's the parameter. simple icon behavior β¨
π₯ NOTES π₯
DROP TABLESPACE cannot be executed inside a transaction block. nope. not happening. don't even try it π«
π EXAMPLES π
To remove tablespace mystuff from the system:
DROP TABLESPACE mystuff;
bye mystuff π you had a good run, bestie π¦
π COMPATIBILITY π
DROP TABLESPACE is a PostgreSQL extension. so like, this is our thing, iykyk π
πΈ SEE ALSO πΈ
CREATE TABLESPACE(CREATE_TABLESPACE(7)) β the making-her eraALTER TABLESPACE(ALTER_TABLESPACE(7)) β the glow-up era
and that's the page!! mwah π this was PostgreSQL 15.19, dated 2026 β go drop those tablespaces responsibly, and remember: empty it first, no transaction blocks, and check your other databases before you commit to the goodbye ππ«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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