DROP_TABLESPACE(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’… 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_tablespaces setting of any active session, the DROP might 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 🌸


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