DROP_SERVER(7pg14)

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

πŸ’… DROP SERVER πŸ’…

okay bestie, real talk β€” this is the DROP SERVER page from the PostgreSQL 14.24 docs (that's the DROP SERVER(7) man page, yes the whole manual-name thing, we're being fancy today ✨). It's short, it's sweet, and it's here to help you yeet a foreign server descriptor into the void. Let's get into it 🫢


🌸 NAME 🌸

DROP_SERVER β€” remove a foreign server descriptor

Like, literally just deletes it. Poof. Gone. Main character exit πŸ’…


✨ SYNOPSIS ✨

DROP SERVER [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

That's the whole vibe right there. Note the [, ...] β€” yes queen, you can list multiple servers, the syntax said so 😌


πŸ¦‹ DESCRIPTION πŸ¦‹

DROP SERVER removes an existing foreign server descriptor. That's the whole job description, no hidden lore.

Heads up though β€” to run this command, the current user must be the owner of the server. No ownership, no dropping. That's the rule, iykyk πŸ”₯

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” doesn't throw an error if the server doesn't exist. Instead it just issues a notice and moves on with its life. Very unbothered of it honestly πŸ™ˆ
  • name β€” the name of an existing server. You gotta actually name the thing you're dropping, bestie, we can't read your mind πŸ’€
  • CASCADE β€” automatically drops objects that depend on the server (such as user mappings), and then in turn all objects that depend on those objects. Yes, it cascades. Yes, it keeps going. See Section 5.14 for the full depend-o-rama. ⭐
  • RESTRICT β€” refuses to drop the server if any objects depend on it. This is the default, so if you don't say anything, this is what you get. Polite, cautious, lowkey iconic 🌈

πŸ’– EXAMPLES πŸ’–

Drop a server foo if it exists:

DROP SERVER IF EXISTS foo;

That's it. That's the example. Chef's kiss 🀌


πŸ‘‘ COMPATIBILITY πŸ‘‘

DROP SERVER conforms to ISO/IEC 9075-9 (SQL/MED). Standards girlie πŸ’…

The IF EXISTS clause, however, is a PostgreSQL extension β€” i.e. our little bonus feature, not part of the standard. Ngl, we ate with that one πŸ“


🌟 SEE ALSO 🌟

The full server lifecycle trilogy, fr fr 🧚


aaaand that's the page! πŸ’œ this was DROP SERVER(7) from the PostgreSQL 14.24 documentation, dated 2026 β€” stay slaying, and remember: own the server before you drop the server πŸŽ€βœ¨

πŸ“¦ where this page comes from