Re: Enhanced error message to include hint messages for redundant options error

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: Enhanced error message to include hint messages for redundant options error
Date: 2021-05-13 14:39:13
Message-ID: CALDaNm3ujLjZ8oihnHMZ7sgLxb8x8gXHFwsOPX8fajoHdqUy_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 13, 2021 at 4:58 AM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> You can avoid duplicating the ereport like this:
>
> + ereport(ERROR,
> + (errcode(ERRCODE_SYNTAX_ERROR),
> + errmsg("option \"%s\" specified more than once", defel->defname),
> + parser ? parser_errposition(pstate, defel->location) : 0));
>
> ... also, since e3a87b4991cc you can now elide the parens around the
> auxiliary function calls:
>

Modified.

> + ereport(ERROR,
> + errcode(ERRCODE_SYNTAX_ERROR),
> + errmsg("option \"%s\" specified more than once", defel->defname),
> + parser ? parser_errposition(pstate, defel->location) : 0));
>
> Please do add a pg_attribute_noreturn() decorator. I'm not sure if any
> compilers will complain about the code flow if you have that, but I
> expect many (all?) will if you don't.

Modified.

Thanks for the comments, Attached patch has the changes for the same.

Regards,
Vignesh

Attachment Content-Type Size
v8-0001-Enhance-error-message.patch text/x-patch 71.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-05-13 14:41:43 Re: compute_query_id and pg_stat_statements
Previous Message Greg Nancarrow 2021-05-13 14:15:07 Re: Parallel scan with SubTransGetTopmostTransaction assert coredump