ALTER_SERVER(7pg15)

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

πŸ’… ALTER_SERVER β€” like, the whole glow-up page for your foreign servers

okay so bestie, welcome to ALTER_SERVER(7) from the PostgreSQL 15.19 docs β€” this is the page where we change the definition of a foreign server. periodt. πŸ¦‹


✨ SYNOPSIS ✨

ALTER SERVER name [ VERSION 'new_version' ]
    [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ]
ALTER SERVER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER SERVER name RENAME TO new_name

🌸 DESCRIPTION 🌸

ALTER SERVER changes the definition of a foreign server. That's the whole vibe. πŸ’–

The first form changes the server version string or the generic options of the server β€” and yes, at least one clause is required there, no sending an empty message into the group chat. The second form changes the owner of the server.

Now, the gatekeeping (affectionate): to alter the server you must be the owner of the server. Literally it. And additionally, to alter the owner, you must own the server and also be a direct or indirect member of the new owning role, and you must have USAGE privilege on the server's foreign-data wrapper.

ngl that's a lot of criteria, but heads up β€” superusers satisfy all these criteria automatically, so they're always slaying. πŸ‘‘

πŸŽ€ PARAMETERS πŸŽ€

  • name β€” the name of an existing server. the main character, basically. ✨
  • new_version β€” new server version. the upgrade era. πŸ¦‹
  • OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) β€” change options for the server. ADD, SET, and DROP specify the action to be performed, and ADD is assumed if no operation is explicitly specified (default queen behavior). Option names must be unique; names and values are also validated using the server's foreign-data wrapper library. πŸ™ˆ
  • new_owner β€” the user name of the new owner of the foreign server. handing over the crown. πŸ‘‘
  • new_name β€” the new name for the foreign server. rebrand era. πŸ’«

πŸ”₯ EXAMPLES πŸ”₯

Alter server foo, add connection options:

ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb');

Alter server foo, change version, change host option:

ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz');

ate. no crumbs. πŸ’…


⭐ COMPATIBILITY ⭐

ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED). The OWNER TO and RENAME forms are PostgreSQL extensions β€” so those two are the homegrown, built-different parts, iykyk.


🌈 SEE ALSO 🌈

the whole friend group fr fr 🫢


okay bye bestie β€” this page is from PostgreSQL 15.19, dated 2026, and it was iconic to read with you. mwah. πŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from