Re: ECPG: WHENEVER statement with DO CONTINUE action

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: vinayak <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ECPG: WHENEVER statement with DO CONTINUE action
Date: 2017-08-25 07:18:22
Message-ID: CAD21AoBk+uCNzb7EzoFc9i6O26qxkYRT5U+wq-Cw6nQNWXgwQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 25, 2017 at 2:57 PM, vinayak
<Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Hi Sawada-san,
>
>
> On 2017/08/25 11:07, Masahiko Sawada wrote:
>>
>> On Fri, Aug 18, 2017 at 5:20 PM, vinayak
>> <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>>>
>>> On 2017/06/20 17:35, vinayak wrote:
>>>>
>>>> Hi Sawada-san,
>>>>
>>>> On 2017/06/20 17:22, Masahiko Sawada wrote:
>>>>>
>>>>> On Tue, Jun 20, 2017 at 1:51 PM, vinayak
>>>>> <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>>>>>>
>>>>>>
>>>>>> On 2017/06/12 13:09, vinayak wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 2017/06/10 12:23, Vinayak Pokale wrote:
>>>>>>
>>>>>> Thank you for your reply
>>>>>>
>>>>>> On Jun 9, 2017 5:39 PM, "Michael Meskes" <meskes(at)postgresql(dot)org>
>>>>>> wrote:
>>>>>>>
>>>>>>> Could you please add a "DO CONTINUE" case to one of the test cases?
>>>>>>> Or
>>>>>>> add a new one? We would need a test case IMO.
>>>>>>>
>>>>>> Yes I will add test case and send updated patch.
>>>>>>
>>>>>> I have added new test case for DO CONTINUE.
>>>>>> Please check the attached patch.
>>>>>>
>>>>>> I have added this in Sept. CF
>>>>>> https://commitfest.postgresql.org/14/1173/
>>>>>>
>>>>> ------
>>>>> In whenever_do_continue.pgc file, the following line seems not to be
>>>>> processed successfully by ecpg but should we fix that?
>>>>>
>>>>> +
>>>>> + exec sql whenever sqlerror continue;
>>>>> +
>>>>>
>>>>> Also, you wrote the test case using "WHENEVER sqlerror DO CONTINUE"
>>>>> action but that seems not to emit sqlerror, so "DO CONTINUE" is not
>>>>> executed. I think the test case for DO CONTINUE should be a C code
>>>>> that executes the "continue" clause.
>>>>
>>>> Thank you for testing the patch.
>>>> I agreed with your comments. I will update the patch.
>>>
>>> Please check the attached updated patch.
>>>
>> Thank you for updating.
>>
>> The regression test failed after applied latest patch by git am.
>>
>> ***
>> /tmp/pg/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
>> 2017-08-24 20:01:10.023201132 -0700
>> ---
>> /tmp/pg/src/interfaces/ecpg/test/results/preproc-whenever_do_continue.c
>> 2017-08-24 20:22:54.308200853 -0700
>> ***************
>> *** 140,147 ****
>> printf("%s %7.2f %9.2f\n", emp.ename, emp.sal, emp.comm);
>> }
>>
>> ! /* This 'CONTINUE' shuts off the 'DO CONTINUE' and allow the
>> program to
>> ! proceed if any further errors do occur. */
>> /* exec sql whenever sqlerror continue ; */
>> #line 53 "whenever_do_continue.pgc"
>>
>> --- 140,147 ----
>> printf("%s %7.2f %9.2f\n", emp.ename, emp.sal, emp.comm);
>> }
>>
>> ! /* This 'CONTINUE' shuts off the 'DO CONTINUE' and allow the
>> program to
>> ! proceed if any further errors do occur. */
>> /* exec sql whenever sqlerror continue ; */
>> #line 53 "whenever_do_continue.pgc"
>>
>> ======================================================================
>>
>> + /* This 'CONTINUE' shuts off the 'DO CONTINUE' and allow the
>> program to
>> + proceed if any further errors do occur. */
>>
>> I think this comment should obey the coding style guide.
>
> Thank you for testing.
>
> I have updated the patch.
> PFA.
>

Thank you for updating the patch. It seems not to incorporate my
second review comment. Attached an updated patch including a fix of a
comment style in whenever_do_continue.pgc file. Please find an
attached file.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
0001-WHENEVER-statement-DO-CONTINUE-support_v3.patch application/octet-stream 17.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vinayak 2017-08-25 07:27:55 Re: ECPG: WHENEVER statement with DO CONTINUE action
Previous Message Antonin Houska 2017-08-25 07:12:48 WIP: Separate log file for extension