Skip to main content
Version: 1.0.16

ALTER SERVER

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_USER | SESSION_USER }

ALTER SERVER name RENAME TO new_name

Description

ALTER SERVER changes the definition of a foreign server. The first form changes the server's version string or the server's general options (at least one clause is required). The second form changes the owner of the server.

To modify the server, you must be its owner. Additionally, to modify the owner, you must own the server and be a direct or indirect member of the new owning role, and you must have USAGE privilege on the server's foreign-data wrapper (note that a superuser automatically satisfies all these policies).

Parameters

name

The name of an existing server.

new_version

The new server version.

OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )

Changes options for the server. ADD, SET, and DROP specify the action to perform. If no operation is explicitly specified, ADD is assumed. Option names must be unique, and names and values are 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 of the foreign server.

Examples

# Modify the server foo, adding connection options:

ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb');

# Modify the server foo, changing the version and host option:

ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz');

See Also

CREATE SERVER, DROP SERVER