Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9405b16

Browse files
committed
Add some more documentation and cross-links on using dblink with SQL/MED.
1 parent 12bc87e commit 9405b16

File tree

4 files changed

+40
-11
lines changed

4 files changed

+40
-11
lines changed

doc/src/sgml/dblink.sgml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/dblink.sgml,v 1.7 2009/06/06 21:27:56 joe Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/dblink.sgml,v 1.8 2009/06/18 14:34:36 petere Exp $ -->
22

33
<sect1 id="dblink">
44
<title>dblink</title>
@@ -45,8 +45,10 @@
4545

4646
<para>
4747
The connection string may also be the name of an existing foreign
48-
server that utilizes the postgresql_fdw foreign data wrapper library.
49-
See the example below, as well as the following:
48+
server. It is recommended to use
49+
the <function>postgresql_fdw_validator</function> when defining
50+
the corresponding foreign-data wrapper. See the example below, as
51+
well as the following:
5052
<simplelist type="inline">
5153
<member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
5254
<member><xref linkend="sql-createserver" endterm="sql-createserver-title"></member>
@@ -134,7 +136,7 @@
134136
-- DETAIL: Non-superuser cannot connect if the server does not request a password.
135137
-- HINT: Target server's authentication method must be changed.
136138
CREATE USER dblink_regression_test WITH PASSWORD 'secret';
137-
CREATE FOREIGN DATA WRAPPER postgresql;
139+
CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;
138140
CREATE SERVER fdtest FOREIGN DATA WRAPPER postgresql OPTIONS (hostaddr '127.0.0.1', dbname 'contrib_regression');
139141

140142
CREATE USER MAPPING FOR dblink_regression_test SERVER fdtest OPTIONS (user 'dblink_regression_test', password 'secret');

doc/src/sgml/ref/create_foreign_data_wrapper.sgml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_foreign_data_wrapper.sgml,v 1.3 2009/02/27 07:20:00 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_foreign_data_wrapper.sgml,v 1.4 2009/06/18 14:34:36 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -103,7 +103,9 @@ CREATE FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
103103
rudimentary. The purpose of foreign-data wrappers, foreign
104104
servers, and user mappings is to store this information in a
105105
standard way so that it can be queried by interested applications.
106-
The functionality to actually query external data does not exist
106+
One such application is <application>dblink</application>;
107+
see <xref linkend="dblink">. The functionality to actually query
108+
external data through a foreign-data wrapper library does not exist
107109
yet.
108110
</para>
109111

doc/src/sgml/ref/create_server.sgml

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_server.sgml,v 1.3 2009/02/27 07:20:00 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_server.sgml,v 1.4 2009/06/18 14:34:36 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -34,6 +34,13 @@ CREATE SERVER <replaceable class="parameter">servername</replaceable> [ TYPE 'se
3434
user who defines the server becomes its owner.
3535
</para>
3636

37+
<para>
38+
A foreign server typically encapsulates connection information that
39+
a foreign-data wrapper uses to access an external data resource.
40+
Additional user-specific connection information may be specified by
41+
means of user mappings.
42+
</para>
43+
3744
<para>
3845
The server name must be unique within the database.
3946
</para>
@@ -98,6 +105,20 @@ CREATE SERVER <replaceable class="parameter">servername</replaceable> [ TYPE 'se
98105
</variablelist>
99106
</refsect1>
100107

108+
<refsect1>
109+
<title>Notes</title>
110+
111+
<para>
112+
When using the <application>dblink</application> module
113+
(see <xref linkend="dblink">), the foreign server name can be used
114+
as an argument of the <xref linkend="contrib-dblink-connect">
115+
function to indicate the connection parameters. See also there for
116+
more examples. It is necessary to have
117+
the <literal>USAGE</literal> privilege on the foreign server to be
118+
able to use it in this way.
119+
</para>
120+
</refsect1>
121+
101122
<refsect1>
102123
<title>Examples</title>
103124

doc/src/sgml/ref/create_user_mapping.sgml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_user_mapping.sgml,v 1.4 2009/02/27 07:20:00 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_user_mapping.sgml,v 1.5 2009/06/18 14:34:36 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -31,7 +31,10 @@ CREATE USER MAPPING FOR { <replaceable class="parameter">username</replaceable>
3131

3232
<para>
3333
<command>CREATE USER MAPPING</command> defines a mapping of a user
34-
to a foreign server.
34+
to a foreign server. A user mapping typically encapsulates
35+
connection information that a foreign-data wrapper uses together
36+
with the information encapsulated be a foreign server to access an
37+
external data resource.
3538
</para>
3639

3740
<para>
@@ -52,8 +55,9 @@ CREATE USER MAPPING FOR { <replaceable class="parameter">username</replaceable>
5255
<para>
5356
The name of an existing user that is mapped to foreign server.
5457
<literal>CURRENT_USER</> and <literal>USER</> match the name of
55-
the current user. <literal>PUBLIC</> is used to match all
56-
present and future user names in the system.
58+
the current user. When <literal>PUBLIC</> is specified, a
59+
so-called public mapping is created that is used when no
60+
user-specific mapping is applicable.
5761
</para>
5862
</listitem>
5963
</varlistentry>

0 commit comments

Comments
 (0)