From: Jeff Ross <jross@openvistas.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Question: what is proper way to define python function as event_trigger?
Date: Sun, 22 Dec 2019 16:20:51 -0700
Message-ID: <51571587-2017-c550-07ef-8e7ade96bbd4@openvistas.net> (raw)
In-Reply-To: <c4b5ce31-027a-d531-3305-4fe9f35c70de@openvistas.net>
References: <0d6c5bdc3ab532bc3240cfb14bc55ce9@gmail.com>
<c4b5ce31-027a-d531-3305-4fe9f35c70de@openvistas.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: jross@openvistas.net
Subject: Re: Question: what is proper way to define python function as event_trigger?
In-Reply-To: <51571587-2017-c550-07ef-8e7ade96bbd4@openvistas.net>
References: <0d6c5bdc3ab532bc3240cfb14bc55ce9@gmail.com> <c4b5ce31-027a-d531-3305-4fe9f35c70de@openvistas.net> <51571587-2017-c550-07ef-8e7ade96bbd4@openvistas.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox