ALTER_SERVER(7pg14)
β¨ ALTER SERVER β¨
okay so bestie, welcome to ALTER SERVER β the PostgreSQL 14.24 glow-up page for foreign servers π
this is where you change the definition of a foreign server, and yes it's as iconic as it sounds. (it's a section 7 page in the PostgreSQL 14.24 docs, if you're keeping track π)
πΈ 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 heads up, at least one clause is required, you can't just send it an empty text and expect anything π₯
the second form changes the owner of the server. new main character, same server π
to alter the server you must be the svr owner. and ooh, the owner-change is the strict one: 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. that's three whole vibe checks π (but ngl, superusers satisfy all these criteria automatically β they're built different fr fr π§)
π¦ PARAMETERS π¦
nameβ the name of an existing server. like, one that already exists, don't come at me with a made-up name πnew_versionβ new server version. literally just the new version, slay.OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )β change options for the server.ADD,SET, andDROPspecify the action to be performed, andADDis assumed if no operation is explicitly specified (default behaviour, we love to see it β). Option names must be unique β no duplicates bestie, that's not the move π β and heads up, 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. fresh name, fresh 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');
see how clean that is?? obsessed π«Ά
π COMPATIBILITY π
ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED) β standards girlie behaviour π
but the OWNER TO and RENAME forms are PostgreSQL extensions, so that's us, being extra, as usual β¨
π SEE ALSO π
CREATE SERVER(CREATE_SERVER(7))DROP SERVER(DROP_SERVER(7))
iykyk β go read those too, they're the whole friend group π¦
and that's the page, bestie! brought to you by PostgreSQL 14.24, dated 2026 β periodt, go alter some servers ππΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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