Re: [doc fix] Add operation of freeing output SQLDA

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: [doc fix] Add operation of freeing output SQLDA
Дата
Msg-id 20180522.105103.233653872.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на [doc fix] Add operation of freeing output SQLDA  ("Kato, Sho" <kato-sho@jp.fujitsu.com>)
Ответы RE: [doc fix] Add operation of freeing output SQLDA  ("Kato, Sho" <kato-sho@jp.fujitsu.com>)
Список pgsql-hackers
Hello.

At Fri, 18 May 2018 06:03:59 +0000, "Kato, Sho" <kato-sho@jp.fujitsu.com> wrote in
<25C1C6B2E7BE044889E4FE8643A58BA963A42097@G01JPEXMBKW03>
> Hello
> 
> I think it is better to add freeing operation of output SQLDA to the current PostgreSQL documentation.
> As far as I can see src/interfaces/ecpg/ecpglib/execute.c,
> if a previously existing sqlda is set to output SQLDA, 
> then a previously existing sqlda is freed.
> But, the new output SQLDA's memory space remain.

I didn't look it closer but generally speaking output sqlda
should be freed automatically (or by ecpg API) since users don't
know it in detail. It is a linked list so just freeing the first
one is not sufficient(*1). On the other hand ecpg library cannot
free input sqlda since it doesn't know how it was provided. Thus
I'm on the documentation side. I'm not sure of the reason for
freeing output sqlda explicitly in the test code, maybe it is to
avoid valgrind complaint or such like..

I think if output sqlda is not freed and finally orphaned after
correct API usage, it should be fixed. I suppose that EXEC SQL
DEALLOCATE DESCRIPTOR is responsible..

> ecpg regression test also free output SQLDA's memory space.
> The attached patch fixes the documentation.


*1: The test code knows the shape exactly so it can properly free
    them in proper way.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Time to put context diffs in the grave