There are remaining two problems

1. Do we need to consider when to delete the extension hook or it's not
necessary?
    As the destroy function _PG_fini doesn't work, I cannot find a good
place to reset to hook gracefully.
    I tested the drop language plpythonu statement which will not remove
the python shared library in the current session,
    So it seems to be safe to leave the cancel_handler_hook not be reset.
    How about other extensions, for example plr. Does the "drop extension"
statement will not remove the loaded shared library in the process either?

    -- Another idea is to register the hook at the beginning of
plpython_call_handler and unregister the hook at the end of
plpython_call_handler.

2. Do we need to use explicit hook list(List *cancel_hook_list) instead of
implicit cancel_hook(which relies on the extension to link the cancel_hook
inside their code
     e.g. prev_hook = cancel_hook; cancel_hook=my_hook;   void
my_hook(){mywork(); (*prev_hook)();} )?
    I didn't find any explicit hook list in PG code base, is that a good
practice?

-- Hubert


On Mon, May 14, 2018 at 6:40 PM, Heikki Linnakangas <hlinn...@iki.fi> wrote:

> On 14/05/18 10:56, Hubert Zhang wrote:
>
>> For nested SPI case, one option is to turn off the bool variable when
>> entering the SPI function(PLy_spi_prepare, PLy_spi_execute, PLy_cursor
>> etc.)
>> and turn on the bool variable again when exiting the SPI function.
>>
>
> Yeah, that seems reasonable.
>
> - Heikki
>



-- 
Thanks

Hubert Zhang

Reply via email to