Re: Question: what is proper way to define python function asevent_trigger? - Mailing list pgsql-general

From Jeff Ross
Subject Re: Question: what is proper way to define python function asevent_trigger?
Date
Msg-id 51571587-2017-c550-07ef-8e7ade96bbd4@openvistas.net
Whole thread Raw
In response to Re: Question: what is proper way to define python function asevent_trigger?  (Jeff Ross <jross@openvistas.net>)
Responses Re: Question: what is proper way to define python function asevent_trigger?
List pgsql-general
On 2019-12-22 16:07, Jeff Ross wrote:
> On 2019-12-22 15:27, Andrei Pozolotin wrote:
>>
>> Hello.
>>
>> Problem:
>>
>> 1. any attempt to define python function as an event_trigger, i.e.:
>>
>> CREATE FUNCTION public.verify()
>> RETURNS event_trigger
>> LANGUAGE 'plpython3u'
>> AS $$ print("hello-kitty") $$;
>>
>> 2. fails with message:
>>
>> ERROR: trigger functions can only be called as triggers
>>
>> SQL state: 0A000
>>
>> 3. here in the source:
>>
>> https://github.com/postgres/postgres/blob/master/src/pl/plpython/plpy_procedure.c#L226 
>>
>>
>> Question:
>>
>> what is proper way to define python function as event_trigger?
>>
>> Thank you.
>>
>>
> Just do
>
> "create function public.verify() as trigger..."
>
My bad--that should be "create function public.verify() returns trigger... "

Jeff




pgsql-general by date:

Previous
From: Jeff Ross
Date:
Subject: Re: Question: what is proper way to define python function asevent_trigger?
Next
From: Tom Lane
Date:
Subject: Re: Question: what is proper way to define python function as event_trigger?