CREATE SERVER
Description
Defines a new foreign server. A foreign server store other homogeneous database information.
Precautions
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
CREATE SERVER server_name FOREIGN DATA WRAPPER fdw_name [ OPTIONS ( { option_name ' value ' } [, ...] ) ];
Parameters
-
Specifies the server name.
Value range: a string containing no more than 63 bytes.
-
Specifies the name of the foreign data wrapper.
Value range: dist_fdw, log_fdw, and file_fdw. log_fdw and file_fdw are used only for syntax compatibility in centralized mode. They can be used to create foreign tables but are not actually used.
-
OPTIONS ( { option_name ' value ' } [, ...] )
Specifies options for the server. These options typically define the connection details of the server, but the actual names and values depend on the foreign data wrapper of the server.
- Specifies the parameters of a foreign server.
In addition to the connection parameters supported by libpq, the following parameters are provided:-
Estimates the startup time required for a foreign table scan. This value usually contains the time taken to establish a connection, analyze the request at the remote end, and generate a plan. The default value is 100. The value is a real number greater than 0.
-
Specifies the additional consumption when each tuple is scanned on a remote server. The value specifies the extra consumption of data transmission between servers. The default value is 0.01. The value is a real number greater than 0.
Examples
Create a server, in which file_fdw is the foreign data wrapper in the database.
-- Create a server. gaussdb=# CREATE SERVER my_server FOREIGN DATA WRAPPER file_fdw; -- Delete the server. gaussdb=# DROP SERVER my_server;
Create another server in the homogeneous cluster, where log_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 log_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