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

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Enhanced error message to include hint messages for redundant options error
Date: 2021-04-30 09:19:34
Message-ID: CAFiTN-ueBLQaAvN7-5BugM-P9iW_WcSAyLbdaU-gNiib20eNZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 30, 2021 at 12:36 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >
> > other comments
> >
> > if (strcmp(defel->defname, "volatility") == 0)
> > {
> > if (is_procedure)
> > - goto procedure_error;
> > + is_procedure_error = true;
> > if (*volatility_item)
> > - goto duplicate_error;
> > + is_duplicate_error = true;
> >
> > Another side effect I see is, in the above check earlier if
> > is_procedure was true it was directly goto procedure_error, but now it
> > will also check the if (*volatility_item) and it may set
> > is_duplicate_error also true, which seems wrong to me. I think you
> > can change it to
> >
> > if (is_procedure)
> > is_procedure_error = true;
> > else if (*volatility_item)
> > is_duplicate_error = true;
>
> Thanks. Done that way, see the attached v3. Let's see what others has to say.
>
> Also attaching Vignesh's v3 patch as-is, just for completion.

Looking into this again, why not as shown below? IMHO, this way the
code will be logically the same as it was before the patch, basically
why to process an extra statement ( *volatility_item = defel;) if we
have already decided to error.

if (is_procedure)
is_procedure_error = true;
else if (*volatility_item)
is_duplicate_error = true;
else
*volatility_item = defel;

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-04-30 09:31:04 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Peter Smith 2021-04-30 09:19:03 Re: Enhanced error message to include hint messages for redundant options error