DROP_SERVER(7pg18)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

๐Ÿ’– DROP SERVER ๐Ÿ’–

okay bestie, so this is the PostgreSQL 18.6 Documentation page for DROP SERVER, and it's genuinely one of the most satisfying little commands ever โ€” it's giving "spring cleaning but make it SQL". ๐Ÿงนโœจ


๐ŸŒธ NAME ๐ŸŒธ

DROP_SERVER โ€” remove a foreign server descriptor

like. it deletes the descriptor. bye girl. ๐Ÿ‘‹


โœจ SYNOPSIS โœจ

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

look at her. so clean. so structured. the brackets are doing their little optional thing, the | is serving choices. iconique. ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

DROP SERVER removes an existing foreign server descriptor. That's the whole assignment, and it ate.

One important little thing though, no cap: to run this command, the current user has to be the owner of the server. So if you're not the owner, this is not your moment. Not your server, not your drop. ๐Ÿซถ


๐ŸŽ€ PARAMETERS ๐ŸŽ€

  • IF EXISTS โ€” bestie this is the "don't be dramatic" flag. If the server doesn't exist, don't throw an error about it. Instead, a notice gets issued. So like, you get told, but nobody's screaming. ๐ŸŒˆ
  • name โ€” the name of an existing server. Yep. That's the one you're dropping. The actual name. Of the server. ๐ŸŒธ
  • CASCADE โ€” okay so this one is the "and everything that came with it" energy. It automatically drops objects that depend on the server โ€” such as user mappings โ€” and then, in turn, all objects that depend on those objects. It's a whole chain reaction, and you should be aware you're starting it. (see Section 5.15) ๐Ÿ‘‘
  • RESTRICT โ€” the cautious queen. This one refuses to drop the server if any objects depend on it. And heads up: this is the default. So if you don't say anything, you're getting RESTRICT whether you asked for it or not. ๐ŸŽ€
ngl if you're unsure, just let RESTRICT do its thing. she's got your back.

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

Drop a server foo if it exists:

DROP SERVER IF EXISTS foo;

see how chill that is? no error if foo isn't there. just vibes. ๐Ÿ’–


๐ŸŒŸ COMPATIBILITY ๐ŸŒŸ

DROP SERVER conforms to ISO/IEC 9075-9 (SQL/MED). So she's standards-compliant, she's legit, she's certified. โœจ

But the IF EXISTS clause? That's a PostgreSQL extension. So that bit is Postgres being extra in the best way, iykyk. ๐Ÿ’…


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • CREATE SERVER (CREATE_SERVER(7)) โ€” the one that made the server in the first place ๐Ÿผ
  • ALTER SERVER (ALTER_SERVER(7)) โ€” the one that changes it instead of deleting it ๐Ÿ™ˆ

๐Ÿ’€ fr fr, if you're about to type CASCADE, read that bullet again first. she's powerful and she means it.

and that's the page, bestie!! this was PostgreSQL 18.6, dated 2026, and DROP SERVER(7) will see you next time. slay, stay safe, and always check your dependencies before you cascade. ๐Ÿฆ‹๐Ÿ’–โœจ๐ŸŽ€๐ŸŒธ

๐Ÿ“ฆ where this page comes from