ALTER_SERVER(7pg18)
โจ 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, andDROPspecify the action to be performed.ADDis 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 ๐ซถ
CREATE SERVER(CREATE_SERVER(7))DROP SERVER(DROP_SERVER(7))
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. ๐๐ฆ๐ธ
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms