Postgresql 中文操作指南

ALTER SERVER

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_ROLE | CURRENT_USER | SESSION_USER }
ALTER SERVER name RENAME TO new_name

Description

ALTER SERVER 更改外部服务器的定义。第一种形式更改服务器版本字符串或服务器的常规选项(至少需要一个子句)。第二种形式更改服务器的所有者。

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

要更改服务器,您必须是服务器的所有者。此外,要更改所有者,您必须能够授予 SET ROLE 至新的所有权角色,并且您必须在服务器的外键数据包装器上具有 USAGE 特权。(注意,超级用户自动满足所有这些标准。)

To alter the server you must be the owner of the server. 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. (Note that superusers satisfy all these criteria automatically.)

Parameters

  • name

    • The name of an existing server.

  • new_version

    • New server version.

  • OPTIONS ( [ ADD | SET | DROP ] _option ['value'] [, …​ ] )_

    • Change options for the server. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. 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

更改服务器 foo ,添加连接选项:

Alter server foo, add connection options:

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

更改服务器 foo ,更改版本,更改 host 选项:

Alter server foo, change version, change host option:

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

Compatibility

ALTER SERVER 符合 ISO/IEC 9075-9(SQL/MED)。 OWNER TORENAME 形式是 PostgreSQL 扩展。

ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED). The OWNER TO and RENAME forms are PostgreSQL extensions.