CREATE SERVER
Description
Creates a foreign server.
A foreign server stores other homogeneous cluster information.
Precautions
Only a system administrator and users with permission to use a specified FOREIGN DATA WRAPPER can create a foreign server. The authorization syntax is as follows:
GRANT USAGE ON FOREIGN DATA WRAPPER fdw_name TO username
fdw_name is the name of the FOREIGN DATA WRAPPER, and username is the name of the user creating a foreign server.
When multi-layer quotation marks are used for sensitive columns (such as password) 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
1 2 3 |
CREATE SERVER server_name FOREIGN DATA WRAPPER fdw_name [ OPTIONS ( { option_name ' value ' } [, ...] ) ]; |
Parameters
- server_name
Specifies the server name.
Value range: a string containing no more than 63 bytes.
- FOREIGN DATA WRAPPER fdw_name
Specifies the name of the foreign data wrapper.
Value range: fdw_name is the data wrapper created by the system during database initialization. Currently, fdw_name can only be gc_fdw for other homogeneous clusters. You can also create dist_fdw, file_fdw, and log_fdw. log_fdw is used only for syntax compatibility and can be used to create foreign tables, but it is meaningless. dist_fdw is used to import GDS data. You do not need to manually create a server using dist_fdw because gsmpp_server is already built in.
- OPTIONS ( { option_name ' value ' } [, ...] )
Specifies the parameters for the foreign server. The detailed parameters are as follows:
Examples
Create a server, in which file_fdw is the FOREIGN DATA WRAPPER existing in the database.
1 2 3 4 5 |
-- Create a server. gaussdb=# CREATE SERVER my_server FOREIGN DATA WRAPPER file_fdw; -- Delete the server. gaussdb=# DROP SERVER my_server; |
You are advised to create another server in the homogeneous cluster, where gc_fdw is the foreign data wrapper in the database.
1 2 3 4 5 6 7 8 9 10 |
-- Create a server. gaussdb=# CREATE SERVER server_remote FOREIGN DATA WRAPPER GC_FDW OPTIONS (address '10.146.187.231:8000,10.180.157.130:8000' , dbname 'test', username 'test', password '********' ); -- Delete the server. gaussdb=# DROP SERVER server_remote; |
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