Re: Enhanced error message to include hint messages for redundant options error
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Dilip Kumar <dilipbalaut@gmail.com>
Date: 2021-05-13T14:39:13Z
Lists: pgsql-hackers
Attachments
- v8-0001-Enhance-error-message.patch (text/x-patch) patch v8-0001
On Thu, May 13, 2021 at 4:58 AM Alvaro Herrera <alvherre@alvh.no-ip.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
Commits
-
Improve reporting of "conflicting or redundant options" errors.
- 2bfb50b3df11 15.0 landed
-
Refactor function parse_subscription_options.
- 8aafb0261675 15.0 cited