From 8255566f9d479fdfeea09da3141d26afdbb5abe2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 10 Oct 2012 16:53:08 -0400 Subject: Create an improved FDW option validator function for contrib/dblink. dblink now has its own validator function dblink_fdw_validator(), which is better than the core function postgresql_fdw_validator() because it gets the list of legal options from libpq instead of having a hard-wired list. Make the dblink extension module provide a standard foreign data wrapper dblink_fdw that encapsulates use of this validator, and recommend use of that wrapper instead of making up wrappers on the fly. Unfortunately, because ad-hoc wrappers *were* recommended practice previously, it's not clear when we can get rid of postgresql_fdw_validator without causing upgrade problems. But this is a step in the right direction. Shigeru Hanada, reviewed by KaiGai Kohei --- doc/src/sgml/dblink.sgml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/dblink.sgml b/doc/src/sgml/dblink.sgml index 72ca765be73..186ab865865 100644 --- a/doc/src/sgml/dblink.sgml +++ b/doc/src/sgml/dblink.sgml @@ -46,12 +46,10 @@ dblink_connect(text connname, text connstr) returns text The connection string may also be the name of an existing foreign - 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: + server. It is recommended to use the foreign-data wrapper + dblink_fdw when defining the corresponding foreign + server. See the example below, as well as the following: - @@ -136,8 +134,7 @@ SELECT dblink_connect('myconn', 'dbname=postgres'); -- 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 VALIDATOR postgresql_fdw_validator; -CREATE SERVER fdtest FOREIGN DATA WRAPPER postgresql OPTIONS (hostaddr '127.0.0.1', dbname 'contrib_regression'); +CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw 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'); GRANT USAGE ON FOREIGN SERVER fdtest TO dblink_regression_test; @@ -173,7 +170,6 @@ REVOKE SELECT ON TABLE foo FROM dblink_regression_test; DROP USER MAPPING FOR dblink_regression_test SERVER fdtest; DROP USER dblink_regression_test; DROP SERVER fdtest; -DROP FOREIGN DATA WRAPPER postgresql; -- cgit v1.2.3