From: bt21masumurak <bt21masumurak@oss.nttdata.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Improve the HINT message of the ALTER command for postgres_fdw
Date: Fri, 08 Oct 2021 16:18:02 +0900
Message-ID: <557d06cebe19081bfcc83ee2affc98d3@oss.nttdata.com> (raw)
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
Attachments:diff.patch (text/x-diff, 740B) downloaddiff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.cindex 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 instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: bt21masumurak@oss.nttdata.com
Subject: Re: Improve the HINT message of the ALTER command for postgres_fdw
In-Reply-To: <557d06cebe19081bfcc83ee2affc98d3@oss.nttdata.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox