ALTER USER MAPPING

用于修改用户与外部服务器映射的 SQL 命令

ALTER USER MAPPING 是一个 DDL 命令,用于修改 PostgreSQL 数据库用户与外部服务器的映射关系。

ALTER USER MAPPING 命令添加于 PostgreSQL 8.4

变更历史

示例

ALTER USER MAPPING 的使用示例

postgres=# CREATE USER MAPPING FOR CURRENT_USER SERVER fdw_test OPTIONS (user 'foo', password 'bar');
CREATE USER MAPPING

postgres=# ALTER USER MAPPING FOR postgres SERVER fdw_test OPTIONS (SET password 'baz');
ALTER USER MAPPING

请注意,如果一个选项在没有明确指定 ADDSETDROP 中的一个时提供,则会假定为 ADD。如果该选项先前已设置,这将导致错误,例如:

postgres=# ALTER USER MAPPING FOR postgres SERVER fdw_test OPTIONS (password 'zoo);
ERROR:  option "password" provided more than once

在这种情况下,必须明确提供 SET

反之,如果为先前未添加的选项提供了 SET,也会发生错误。

postgres=# CREATE USER MAPPING FOR foo SERVER fbw_test options(username 'bar');
CREATE USER MAPPING

postgres=# ALTER USER MAPPING FOR foo SERVER fdw_test OPTIONS (SET password 'baz');
ERROR:  option "password" not found

分类

DDL, 外部数据包装器 (FDW), SQL 命令, 用户和角色

另请参阅

CREATE USER MAPPING, DROP USER MAPPING, pg_user_mapping

反馈

在此处 提交有关“ALTER USER MAPPING”的任何评论、建议或更正。 here