summaryrefslogtreecommitdiff
path: root/contrib/dblink/sql
diff options
context:
space:
mode:
authorFujii Masao2021-10-26 15:46:52 +0000
committerFujii Masao2021-10-26 15:46:52 +0000
commit5fedf7417b69295294b154a219edd8a26eaa6ab6 (patch)
treeb4f12ec5168d7021b7fbd71c55277d448f54b6cd /contrib/dblink/sql
parente63ce9e8d6ac8dced20592c4134004640f9f5644 (diff)
Improve HINT message that FDW reports when there are no valid options.
The foreign data wrapper's validator function provides a HINT message with list of valid options for the object specified in CREATE or ALTER command, when the option given in the command is invalid. Previously postgresql_fdw_validator() and the validator functions for postgres_fdw and dblink_fdw worked in that way even there were no valid options in the object, which could lead to the HINT message with empty list (because there were no valid options). For example, ALTER FOREIGN DATA WRAPPER postgres_fdw OPTIONS (format 'csv') reported the following ERROR and HINT messages. This behavior was confusing. ERROR: invalid option "format" HINT: Valid options in this context are: There is no such issue in file_fdw. The validator function for file_fdw reports the HINT message "There are no valid options in this context." instead in that case. This commit improves postgresql_fdw_validator() and the validator functions for postgres_fdw and dblink_fdw so that they do likewise. For example, this change causes the above ALTER FOREIGN DATA WRAPPER command to report the following messages. ERROR: invalid option "nonexistent" HINT: There are no valid options in this context. Author: Kosei Masumura Reviewed-by: Bharath Rupireddy, Fujii Masao Discussion: https://postgr.es/m/557d06cebe19081bfcc83ee2affc98d3@oss.nttdata.com
Diffstat (limited to 'contrib/dblink/sql')
-rw-r--r--contrib/dblink/sql/dblink.sql3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql
index 3e96b985712..7a71817d65b 100644
--- a/contrib/dblink/sql/dblink.sql
+++ b/contrib/dblink/sql/dblink.sql
@@ -463,6 +463,9 @@ DROP USER regress_dblink_user;
DROP USER MAPPING FOR public SERVER fdtest;
DROP SERVER fdtest;
+-- should fail
+ALTER FOREIGN DATA WRAPPER dblink_fdw OPTIONS (nonexistent 'fdw');
+
-- test asynchronous notifications
SELECT dblink_connect(connection_parameters());