Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connectionin ECPG - Mailing list pgsql-hackers

From Ideriha, Takeshi
Subject Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connectionin ECPG
Date
Msg-id 4E72940DA2BF16479384A86D54D0988A5659E1D2@G01JPEXMBKW04
Whole thread Raw
In response to Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connectionin ECPG  ("Ideriha, Takeshi" <ideriha.takeshi@jp.fujitsu.com>)
Responses Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connectionin ECPG
List pgsql-hackers

Hi

 

>[004_declareStmt_test_v3.patch]

>Regression test and answers.

>I made them but I'm thinking these include too much test cases, don't they?

>So I'm planning to make it smaller.

 

I refactored the regression test patch (004_declareStmt_test_v4.patch)

to make it easier to read.

 

The other patches are same as previous versions.

 

Regards

Ideriha, Takeshi

 

From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Ideriha, Takeshi
Sent: Tuesday, February 7, 2017 5:59 PM
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Michael Meskes <meskes@postgresql.org>; pgsql-hackers@postgresql.org
Subject: Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connection in ECPG

 

Hi

 

> By the way, I have been able to crash your patch when running the regression

> tests:

> (lldb) bt

> * thread #1: tid = 0x0000, 0x00007fff89a828b0

> libsystem_platform.dylib`_platform_strcmp + 176, stop reason = signal SIGSTOP

>   * frame #0: 0x00007fff89a828b0 libsystem_platform.dylib`_platform_strcmp +

> 176

>     frame #1: 0x000000010c835bc3

> libecpg.6.dylib`ecpg_release_declared_statement(connection_name="con3")

> + 83 at prepare.c:740

>     frame #2: 0x000000010c838103

> libecpg.6.dylib`ECPGdisconnect(lineno=81, connection_name="ALL") + 179 at

> connect.c:697

>     frame #3: 0x000000010c811922 declare`main(argc=1,

> argv=0x00007fff533ee320) + 434 at declare.pgc:81

>     frame #4: 0x00007fff932345ad libdyld.dylib`start + 1

>

> You also need to add in src/interfaces/ecpg/test/sql/.gitignore new entries

> related to the files you are adding and that get generated.

 

Thank you very much for your test. I fixed this memory leak bug, and fixed .gitignore.

 

I also fixed some code style to fit coding conventions,

and splited my patch into 4 parts to improve readability:

* 001_declareStmt_preproc_v3.patch

* 002_declareStmt_ecpglib_v3.patch

* 003_declareStmt_doc_v3.patch

* 004_declareStmt_test_v3.patch

 

Here is a short summary:

[001_declareStmt_preproc_v3.patch]

This enables ecpg to pre-process "DECLARE prepared_name STATEMENT".

prepared_name is buffered to g_declared_list to check duplication of prepared_name.

After pre-processed, "DECLARE STATEMENT" is translated to ECPGdeclare().

And CUSRSOR STAETEMENT such as OPEN/FETCH/CLOSE cursor is translated into ECPGopen()/ECPGfetch()/ECPGclose().

These new function is defined at 002_declareStmt_ecpglib_v3.patch.

 

[002_declareStmt_ecpglib_v3.patch]

This patch mainly implements ECPGdeclare(), ECPGopen(), ECPGfetch(), ECPGclose().

ECPGdeclare() links the declared name and connection name.

 

Handling CURSOR things are originally done by ECPGdo().

But in order to handle connection linked to declared name,

the functions such as ECPGopen(), ECPGfetch()and ECPGclose() are introduced and these functions wraps ecpg_do().

 

[003_declareStmt_doc_v3.patch]

Docs. I wrote the DECLARE STATEMENT itself.

And added another example to ecpg-set-connection.

 

[004_declareStmt_test_v3.patch]

Regression test and answers.

I made them but I'm thinking these include too much test cases, don't they?

So I'm planning to make it smaller.

 

regards,

Ideriha Takeshi

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] SCRAM authentication, take three
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] delta relations in AFTER triggers