Re: Improve the HINT message of the ALTER command for postgres_fdw

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: bt21masumurak <bt21masumurak(at)oss(dot)nttdata(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve the HINT message of the ALTER command for postgres_fdw
Date: 2021-10-13 17:36:56
Message-ID: 4dbda741-2e88-fd07-c2a6-396d776ccf20@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/10/13 14:00, Bharath Rupireddy wrote:
> On Tue, Oct 12, 2021 at 11:11 PM Fujii Masao
> <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>> BTW, I found file_fdw.c, dblink.c, postgres_fdw/option.c and foreign.c
>> use different error codes for the same error message as follows.
>> They should use the same error code? If yes, ISTM that
>> ERRCODE_FDW_INVALID_OPTION_NAME is better because
>> the error message is "invalid option ...".
>>
>> - ERRCODE_FDW_INVALID_OPTION_NAME (file_fdw.c)
>> - ERRCODE_FDW_OPTION_NAME_NOT_FOUND (dblink.c)
>> - ERRCODE_FDW_INVALID_OPTION_NAME (postgres_fdw/option.c)
>> - ERRCODE_SYNTAX_ERROR (foreign.c)
>
> Good catch. ERRCODE_FDW_INVALID_OPTION_NAME seems reasonable to me. I
> think we can remove the error code ERRCODE_FDW_OPTION_NAME_NOT_FOUND
> (it is being used only by dblink.c), instead use
> ERRCODE_FDW_INVALID_OPTION_NAME for all option parsing and
> validations.

Alvaro told me the difference of those error codes as follows at [1].
This makes me think that ERRCODE_FDW_OPTION_NAME_NOT_FOUND
is more proper for the error message. Thought?

-----------------------
in SQL/MED compare GetServerOptByName: INVALID OPTION NAME is used
when the buffer length does not match the option name length;
OPTION NAME NOT FOUND is used when an option of that name is not found
-----------------------

[1] https://twitter.com/alvherre/status/1447991206286348302

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment Content-Type Size
alter_foreign_data_wrapper_options_v3.patch text/plain 7.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-13 17:39:33 Re: prevent immature WAL streaming
Previous Message Alvaro Herrera 2021-10-13 17:27:58 Re: prevent immature WAL streaming