ALTER SERVER
Description
Adds, modifies, or deletes the parameters of an existing server. You can query existing servers from the pg_foreign_server system catalog.
Precautions
- Only the server owner or a user granted with the ALTER permission can run the ALTER SERVER command. The system administrator has this permission by default. To change the owner of a server, the current user must be the owner of the server or the system administrator, and the user must be a member of the new owner role.
- When multi-layer quotation marks are used for sensitive columns (such as password and secret_access_key) in OPTIONS, the semantics is different from that in the scenario where quotation marks are not used. Therefore, sensitive columns are not identified for anonymization.
Syntax
- Change the parameters for a foreign server.
1 2 |
ALTER SERVER server_name [ VERSION 'new_version' ] [ OPTIONS ( {[ ADD | SET | DROP ] option ['value']} [, ... ] ) ]; |
In OPTIONS, ADD, SET, and DROP are operations to be performed. If these operations are not specified, ADD operations will be performed by default. option and value are the parameters of the corresponding operation.
- Change the owner of a foreign server.
1 2 |
ALTER SERVER server_name OWNER TO new_owner; |
- Change the name of a foreign server.
1 2 |
ALTER SERVER server_name RENAME TO new_name; |
Parameters
- server_name
Specifies the name of the server to be modified.
- new_version
Specifies the new version of the server.
- OPTIONS
Change options of the server. ADD, SET, and DROP are operations to be performed. If the operation is not set explicitly, ADD is used. The option name must be unique, and the name and value are also validated with the foreign data wrapper library of the server.
Options for modifying a server are as follows:- encrypt
Specifies whether to encrypt data. This parameter can be set only when type is set to OBS. The default value is off.
Value range:
- on indicates that data is encrypted.
- off indicates that data is not encrypted.
- access_key
Specifies the access key (AK) (obtained by users from the OBS console) used for the OBS access protocol. This parameter is available only when type is set to OBS.
- secret_access_key
Specifies the secret key (SK) value (obtained by users from the OBS console) used for the OBS access protocol. This parameter is available only when type is set to OBS.
- encrypt
- new_owner
Specifies the new owner of the server. To change the owner, you must be the owner of the foreign server and a direct or indirect member of the new owner role, and must have the USAGE permission on the encapsulator of the foreign server.
- new_name
Specifies the new name of the server.
Examples
1 2 3 4 5 6 7 8 |
-- Create my_server. gaussdb=# CREATE SERVER my_server FOREIGN DATA WRAPPER log_fdw; -- Change the name of an external service. gaussdb=# ALTER SERVER my_server RENAME TO my_server_1; -- Delete my_server_1. gaussdb=# DROP SERVER my_server_1; |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot