DROP_TABLESPACE(7pg13)
π DROP_TABLESPACE(7pg13) β the "bye tablespace" glow-up
okay bestie, so this is the PostgreSQL 13.23 Documentation page for DROP_TABLESPACE, and it's literally the manual for yeeting a tablespace out of your system. very demure, very "get it off my server" energy. let's go π¦
β¨ NAME β¨
DROP_TABLESPACE β remove a tablespace π
β¨ SYNOPSIS β¨
DROP TABLESPACE [ IF EXISTS ] name
that bracket situation around IF EXISTS means it's optional, iykyk π
β¨ DESCRIPTION β¨
so DROP TABLESPACE removes a tablespace from the system. periodt. ποΈ
but ngl, there are rules β and they are rules:
- a tablespace can only be dropped by its owner or a superuser π
- the tablespace must be empty of all database objects before it can be dropped. like, fully empty. no sneaky leftovers π
- heads up: objects in other databases might still reside in the tablespace, even if no objects in the current database are using it. so the vibe check has to happen across all your databases, fr fr π
- also!! if the tablespace is listed in the
temp_tablespacessetting of any active session, theDROPmight fail due to temporary files residing in the tablespace π
so yeah, if your drop keeps failing β check for objects in other DBs and check temp_tablespaces on every active session. not me learning this the hard way π«Ά
β¨ PARAMETERS β¨
IF EXISTSβ don't throw an error if the tablespace doesn't exist. instead a notice is issued in this case πΈ (very "no thoughts, no error" of it)nameβ the name of a tablespace. that's it, that's the parameter π
β¨ NOTES β¨
DROP TABLESPACE cannot be executed inside a transaction block. no cap. don't try it, bestie π€
β¨ EXAMPLES β¨
to remove tablespace mystuff from the system:
DROP TABLESPACE mystuff;
iconic. ate. leaving no crumbs π₯
β¨ COMPATIBILITY β¨
DROP TABLESPACE is a PostgreSQL extension. it's giving "we made this ourselves" β¨
β¨ SEE ALSO β¨
CREATE TABLESPACE(CREATE_TABLESPACE(7)) β the making-it version πALTER TABLESPACE(ALTER_TABLESPACE(7)) β the changing-it version π¦
and that's the whole page, bestie!! π«Ά this was PostgreSQL 13.23, dated 2025, and you're all caught up on DROP TABLESPACE. go forth and drop responsibly πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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