ALTER_SERVER(7pg16)
π ALTER SERVER (7pg16) β the glow-up page
okay bestie, so this is the ALTER SERVER page straight out of the PostgreSQL 16.15 documentation, and it's literally all about giving your foreign server a little makeover β¨ no cap.
πΈ 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
like, three whole forms, pick your fighter π
π¦ 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 show up with nothing π
The second form changes the owner of the server.
To alter the server you must be the owner of the server. That's the baseline, bestie. And additionally, to alter the owner, you must be able to SET ROLE to the new owning role, and you must have USAGE privilege on the server's foreign-data wrapper. Stacked requirements, I know π
π cute little note from the docs: superusers satisfy all these criteria automatically. main character energy fr fr π
β¨ PARAMETERS
nameβ the name of an existing server. has to exist already, we're not manifesting it into being πnew_versionβ the new server version. cute new number, same server.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 (so if you're lazy about it, it just adds π ). Option names must be unique β no duplicates allowed, periodt. And names and values are also validated using the server's foreign-data wrapper library, so it's not just vibes, it's actual verification π₯new_ownerβ the user name of the new owner of the foreign server. passing 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');
see how clean that is? ate, no crumbs π
π₯ COMPATIBILITY
ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED) β standard girlie behavior β¨
The OWNER TO and RENAME forms are PostgreSQL extensions though, so those two are the homegrown originals π
π SEE ALSO
CREATE SERVER(CREATE_SERVER(7)) β for when you're starting from scratch π±DROP SERVER(DROP_SERVER(7)) β for when it's time to let go π
π§ and that's the whole page, bestie! PostgreSQL 16.15, dated 2026 β go forth and alter responsibly, ily πππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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