DROP_TABLESPACE(7pg16)

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

🌸 NAME 🌸

okay bestie, this is the DROP TABLESPACE(7) page from the PostgreSQL 16 docs β€” the whole vibe is remove a tablespace. πŸ’…


✨ SYNOPSIS ✨

DROP TABLESPACE [ IF EXISTS ] name

🫢 DESCRIPTION 🫢

DROP TABLESPACE removes a tablespace from the system. no cap, that's the main character move. ✨

Only the tablespace's owner or a superuser can drop it. The tablespace must be empty of all database objects before it can be dropped β€” literally all of them, bestie. 🫢

And heads up: objects in other databases might still reside in the tablespace even if no objects in the current database are using it. also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP might fail due to temporary files residing in the tablespace. 😭


πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the tablespace does not exist. a notice is issued in this case. so polite, honestly. πŸŽ€
  • name β€” the name of a tablespace. simple as that. πŸ’–

πŸ”₯ NOTES πŸ”₯

DROP TABLESPACE cannot be executed inside a transaction block. periodt. πŸ”₯

🌈 EXAMPLES 🌈

to remove tablespace mystuff from the system:

DROP TABLESPACE mystuff;

iconic. clean. very demure. ✨


πŸ‘‘ COMPATIBILITY πŸ‘‘

DROP TABLESPACE is a PostgreSQL extension. πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹


mwah πŸ’‹ β€” this one comes from PostgreSQL 16.15, dated 2026. xoxo, go drop that tablespace responsibly. πŸ’–

πŸ“¦ where this page comes from