Re: event trigger support for PL/Python

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: event trigger support for PL/Python
Дата
Msg-id a654c6d4-725c-4ae8-b349-e13a113d0df5@app.fastmail.com
обсуждение исходный текст
Ответ на Re: event trigger support for PL/Python  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: event trigger support for PL/Python
Список pgsql-hackers
On Wed, Aug 6, 2025, at 5:16 PM, Pavel Stehule wrote:
>
> I am checking the code, and I don't like too much an introduction of 
> PLPyTrigType - more when it is used in 
> the pair with variable is_trigger. This combination looks strange and 
> it is a little bit difficult to read for me.
>
> Maybe I prefer some like
>
> typedef enum {
>   PLPY_CALLED_AS_TRIGGER,
>   PLPY_CALLED_AS_EVENT_TRIGGER,
>   PLPY_CALLED_AS_FUNCTION
> } PLPyCallType;
>

I used the same pattern as PL/pgSQL

typedef enum PLpgSQL_trigtype
{
    PLPGSQL_DML_TRIGGER,
    PLPGSQL_EVENT_TRIGGER,
    PLPGSQL_NOT_TRIGGER,
} PLpgSQL_trigtype;

Are you suggesting that we should modify it too?

> and then instead
>
> if (is_trigger == PLPY_NOT_TRIGGER)
>
> the code can looks like
>
> if (call_type == PLPY_CALLED_AS_FUNCTION)
> {
>
> }
>

The is_trigger variable is similar to fn_is_trigger in PL/pgSQL (see
PLpgSQL_function). If this variable is not clear maybe a prefix should avoid
confusion.


-- 
Euler Taveira
EDB   https://www.enterprisedb.com/



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