ALTER_SERVER(7pg16)

πŸ“¦ version 16.15, in opensuse-leap 16.0

πŸ’… 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, and DROP specify the action to be performed, and ADD is 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