From 9405b16f3a2c8d504f7be15912d9cd00261449fb Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 18 Jun 2009 14:34:36 +0000 Subject: [PATCH] Add some more documentation and cross-links on using dblink with SQL/MED. --- doc/src/sgml/dblink.sgml | 10 ++++---- .../sgml/ref/create_foreign_data_wrapper.sgml | 6 +++-- doc/src/sgml/ref/create_server.sgml | 23 ++++++++++++++++++- doc/src/sgml/ref/create_user_mapping.sgml | 12 ++++++---- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/dblink.sgml b/doc/src/sgml/dblink.sgml index 06fcc8cee8..2afa40a29f 100644 --- a/doc/src/sgml/dblink.sgml +++ b/doc/src/sgml/dblink.sgml @@ -1,4 +1,4 @@ - + dblink @@ -45,8 +45,10 @@ The connection string may also be the name of an existing foreign - server that utilizes the postgresql_fdw foreign data wrapper library. - See the example below, as well as the following: + server. It is recommended to use + the postgresql_fdw_validator when defining + the corresponding foreign-data wrapper. See the example below, as + well as the following: @@ -134,7 +136,7 @@ -- DETAIL: Non-superuser cannot connect if the server does not request a password. -- HINT: Target server's authentication method must be changed. CREATE USER dblink_regression_test WITH PASSWORD 'secret'; - CREATE FOREIGN DATA WRAPPER postgresql; + CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator; CREATE SERVER fdtest FOREIGN DATA WRAPPER postgresql OPTIONS (hostaddr '127.0.0.1', dbname 'contrib_regression'); CREATE USER MAPPING FOR dblink_regression_test SERVER fdtest OPTIONS (user 'dblink_regression_test', password 'secret'); diff --git a/doc/src/sgml/ref/create_foreign_data_wrapper.sgml b/doc/src/sgml/ref/create_foreign_data_wrapper.sgml index bc615476bd..dd48245372 100644 --- a/doc/src/sgml/ref/create_foreign_data_wrapper.sgml +++ b/doc/src/sgml/ref/create_foreign_data_wrapper.sgml @@ -1,5 +1,5 @@ @@ -103,7 +103,9 @@ CREATE FOREIGN DATA WRAPPER name rudimentary. The purpose of foreign-data wrappers, foreign servers, and user mappings is to store this information in a standard way so that it can be queried by interested applications. - The functionality to actually query external data does not exist + One such application is dblink; + see . The functionality to actually query + external data through a foreign-data wrapper library does not exist yet. diff --git a/doc/src/sgml/ref/create_server.sgml b/doc/src/sgml/ref/create_server.sgml index c588e6b3e6..c828c5a28b 100644 --- a/doc/src/sgml/ref/create_server.sgml +++ b/doc/src/sgml/ref/create_server.sgml @@ -1,5 +1,5 @@ @@ -34,6 +34,13 @@ CREATE SERVER servername [ TYPE 'se user who defines the server becomes its owner. + + A foreign server typically encapsulates connection information that + a foreign-data wrapper uses to access an external data resource. + Additional user-specific connection information may be specified by + means of user mappings. + + The server name must be unique within the database. @@ -98,6 +105,20 @@ CREATE SERVER servername [ TYPE 'se + + Notes + + + When using the dblink module + (see ), the foreign server name can be used + as an argument of the + function to indicate the connection parameters. See also there for + more examples. It is necessary to have + the USAGE privilege on the foreign server to be + able to use it in this way. + + + Examples diff --git a/doc/src/sgml/ref/create_user_mapping.sgml b/doc/src/sgml/ref/create_user_mapping.sgml index 6d40eaf936..ab7ff7fdb1 100644 --- a/doc/src/sgml/ref/create_user_mapping.sgml +++ b/doc/src/sgml/ref/create_user_mapping.sgml @@ -1,5 +1,5 @@ @@ -31,7 +31,10 @@ CREATE USER MAPPING FOR { username CREATE USER MAPPING defines a mapping of a user - to a foreign server. + to a foreign server. A user mapping typically encapsulates + connection information that a foreign-data wrapper uses together + with the information encapsulated be a foreign server to access an + external data resource. @@ -52,8 +55,9 @@ CREATE USER MAPPING FOR { username The name of an existing user that is mapped to foreign server. CURRENT_USER and USER match the name of - the current user. PUBLIC is used to match all - present and future user names in the system. + the current user. When PUBLIC is specified, a + so-called public mapping is created that is used when no + user-specific mapping is applicable.