Re: Enhanced error message to include hint messages for redundant options error - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Enhanced error message to include hint messages for redundant options error
Date
Msg-id CAFiTN-ueBLQaAvN7-5BugM-P9iW_WcSAyLbdaU-gNiib20eNZw@mail.gmail.com
Whole thread Raw
In response to Re: Enhanced error message to include hint messages for redundant options error  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Enhanced error message to include hint messages for redundant options error  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Fri, Apr 30, 2021 at 12:36 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.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



pgsql-hackers by date:

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