ALTER_SERVER(7)

โœจ ALTER SERVER โ€” the ALTER_SERVER(7) glow-up ๐Ÿ’…

okay bestie, welcome to the Postgres 18.6 docs โ€” this is the manual page for ALTER SERVER, and we're about to make your foreign server โœจdifferentโœจ. Not new. Not deleted. Just... changed. Iconic behavior honestly.


๐ŸŒธ NAME ๐ŸŒธ

ALTER_SERVER โ€” change the definition of a foreign server ๐Ÿฆ‹


๐ŸŽ€ 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

three whole forms, three whole vibes, pick your fighter ๐Ÿ’œ


๐Ÿ’– DESCRIPTION ๐Ÿ’–

ALTER SERVER changes the definition of a foreign server. That's the whole assignment, no cap.

The first form changes the server version string or the generic options of the server. At least one clause is required โ€” you can't just run it and hope for the best, bestie, the server needs to know what you want.

The second form changes the owner of the server.

Now the permission tea ๐Ÿต: to alter the server you must be the owner of the server. And if you're changing the owner too? You additionally need to be able to SET ROLE to the new owning role, and you must have USAGE privilege on the server's foreign-data wrapper. (Note that superusers satisfy all these criteria automatically โ€” main character energy, they just get in. ๐Ÿ‘‘)


โœจ PARAMETERS โœจ

  • name โ€” the name of an existing server. It has to already exist, we're not manifesting servers out here.
  • new_version โ€” new server version.
  • OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) โ€” change options for the server. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified (so it's giving default, very chill of it). 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.
  • new_name โ€” the new name for the foreign server.

๐ŸŒˆ 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');

see? simple. ate. ๐Ÿ’…


๐Ÿ’œ 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 ones, iykyk. ๐ŸŒŸ


๐Ÿซถ SEE ALSO ๐Ÿซถ


and that's the whole page, bestie!! ๐ŸŽ€โœจ This gorgeous little number came to you straight from the PostgreSQL 18.6 Documentation, dated 2026 โ€” so if you're reading this in some other era, check the version, fr fr. Now go forth and alter responsibly, you absolute server-owning icon. ๐Ÿ’–๐Ÿฆ‹๐ŸŒธ