ALTER_SERVER(7pg13)
π ALTER SERVER (7pg13) β the glow-up your foreign server deserves β¨
Okay so like, this is the ALTER SERVER page from the PostgreSQL 13.23 Documentation bestie. It's literally the manual for changing up a foreign server's whole situation. Periodt. π
πΈ NAME πΈ
ALTER_SERVER β change the definition of a foreign server, no cap π
β¨ SYNOPSIS β¨
ALTER SERVER name [ VERSION 'new_version' ]
[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ]
ALTER SERVER name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER SERVER name RENAME TO new_name
π¦ DESCRIPTION π¦
So ALTER SERVER does exactly what it says on the tin bestie β it changes the definition of a foreign server. π
The first form changes the server version string or the generic options of the server (and like, you need at least one clause β you can't just slide in with nothing, that's not the vibe). π«Ά
The second form changes the owner of the server. Main character ownership energy.
β οΈ Okay so listen: to alter the server you must be the owner of the server. And 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. (Not me listing three whole requirements π β but note that superusers satisfy all these criteria automatically, so they're chilling.) π
π PARAMETERS π
nameβ the name of an existing server. Like, it's gotta already exist fr fr. πnew_versionβ new server version. Fresh version, new era. β¨OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )β change options for the server.ADD,SET, andDROPspecify the action to be performed. If you don't explicitly specify an operation,ADDis assumed (it's giving default behavior π). Option names must be unique β no gatekeeping the same name twice β and names and values are also validated using the server's foreign-data wrapper library. Iconic validation moment. π―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 β watch her slay:
ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb');
Alter server foo, change version, change host option β the glow-up continues:
ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz');
π COMPATIBILITY π
ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED). Respectfully, standards queen. π
But lowkey β the OWNER TO and RENAME forms are PostgreSQL extensions, so don't come for standards compliance when those two are doing their own thing. π
π SEE ALSO π
CREATE SERVER(CREATE_SERVER(7)) β for when you're starting fresh, bestieDROP SERVER(DROP_SERVER(7)) β for when it's time to say bye π
Alright that's the whole thing, no notes. π This has been the ALTER SERVER(7) page, brought to you by PostgreSQL 13.23 β yes, 13.23, that's the version, dated 2025, and honestly? She ate. Periodt. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms