DROP_TABLESPACE(7pg17)

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

πŸ’– 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 🧚


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