Hi

When 'ALTER FOREIGN DATA WRAPPER OPTIONS' is executed against postgres_fdw, the HINT message is printed as shown below, even though there are no valid options in this context.

=# ALTER FOREIGN DATA WRAPPER postgres_fdw OPTIONS (format 'csv');
ERROR: invalid option "format"
HINT: Valid options in this context are:

I made a patch for this problem.


regards,
Kosei Masumura
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index 5bb1af4084..19edf98360 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -107,8 +107,10 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
 			ereport(ERROR,
 					(errcode(ERRCODE_FDW_INVALID_OPTION_NAME),
 					 errmsg("invalid option \"%s\"", def->defname),
-					 errhint("Valid options in this context are: %s",
-							 buf.data)));
+					 buf.len > 0
+                                         ? errhint("Valid options in this context are: %s",
+                                                         buf.data)
+                                         : errhint("There are no valid options in this context.")));
 		}
 
 		/*

Reply via email to