Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ij9gs-0004rY-U4 for pgsql-general@arkaria.postgresql.org; Sun, 22 Dec 2019 22:27:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ij9gr-0001eh-Mv for pgsql-general@arkaria.postgresql.org; Sun, 22 Dec 2019 22:27:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ij9gr-0001ea-7y for pgsql-general@lists.postgresql.org; Sun, 22 Dec 2019 22:27:09 +0000 Received: from mail-yw1-xc33.google.com ([2607:f8b0:4864:20::c33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ij9go-0002cp-Dq for pgsql-general@lists.postgresql.org; Sun, 22 Dec 2019 22:27:07 +0000 Received: by mail-yw1-xc33.google.com with SMTP id z7so6459217ywd.4 for ; Sun, 22 Dec 2019 14:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:date:from:to:subject:message-id:user-agent; bh=nK/IuyngdZn+XYmTsvYPAfdVh6WngDu2HYcHaGPbl3Q=; b=qDKczb0XnnUua+Bdu7fDlySgiJG38KpSklE3L7Nn7+nIkGKm+51EawDT1WPD79hGQv O3WDJGtu0COTn2C3475pdmOxa95s5+PhhmZp+k1GeiyDwZoTEpYBGX5NLMXL/csTRH2r pbEiQyvhnmSXJ8S1uC2LW3hMIAPh8K7oJdNV8nOGiUe6rtc+hob8yaa8foeVP+Ie01qL HKr3oVtR5NmTSFr4Paz2eaLGrkDhZYrl6n7c3gMLx4C1e/GNhC5Hp2aX3GGYubvAacwo YgrLL9nqsEGxO6Zh+GQEZg8ujaoIh71zCCGunZG6h9he8+qtA62o1iImawsq91ZLXCcR TndQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:from:to:subject:message-id :user-agent; bh=nK/IuyngdZn+XYmTsvYPAfdVh6WngDu2HYcHaGPbl3Q=; b=AfR3uosaF0ESt8gEFngu+MP+icaXOfiPmC2vHvr3DLXBaCSymSYHYTFz6mG4f9In05 kUxJ1RyORIc3yn7SPEwy/Ha1k8f+vu1RdFaa6Vk/kKRUtBfkJK7Gdtimg55ncvlmBTNq 54n7x6jTAtr7qa6jN4lGnDHES39w/b3cQPnblkViSzP3o4WtXqNfSYndskN7Sn8aTXkX wNMjlmtvuse6dh35umIt4r2cO/mElq0l1Lqm6lbbkgP7jjiSla9KiJXcsQWaeDgs7wme MsZPZRXKzacoeUy3ts4sBN0nClZq74WKoD6xJf6oX1gMCpl4i5DHXSV0xcEn274OH08v 9dYg== X-Gm-Message-State: APjAAAVMH/gzusU5+6RaLZknNXZbcj8q/FN4Zr5lt4CpM7//udwZf8M5 B5PsH0nqcs8sccPQ7TYh4tVzDPJH2wo= X-Google-Smtp-Source: APXvYqw7oL/vmT3nSyu50a69gkHQFoUYSqJbxnO9Q5hQwBMC0qOUQZwzVEENvolK0Ujbfu30kvjKLw== X-Received: by 2002:a0d:ce02:: with SMTP id q2mr19836505ywd.400.1577053624917; Sun, 22 Dec 2019 14:27:04 -0800 (PST) Received: from mail-cube (c-73-74-24-80.hsd1.il.comcast.net. [73.74.24.80]) by smtp.gmail.com with ESMTPSA id 205sm7107275ywm.17.2019.12.22.14.27.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Dec 2019 14:27:03 -0800 (PST) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_e4a97207e815d08b2847be606091e6ba" Date: Sun, 22 Dec 2019 16:27:02 -0600 From: Andrei Pozolotin To: pgsql-general@lists.postgresql.org Subject: Question: what is proper way to define python function as event_trigger? Message-ID: <0d6c5bdc3ab532bc3240cfb14bc55ce9@gmail.com> X-Sender: andrei.pozolotin@gmail.com User-Agent: Roundcube Webmail/1.3.10 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_e4a97207e815d08b2847be606091e6ba Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII 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. --=_e4a97207e815d08b2847be606091e6ba Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Hello.

Problem:

1. any attempt to define python function as an event_trigger, i.e= =2E:

CREATE FUNCTION public.verify()
RETURNS event_trigger
LANGUA= GE '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.


--=_e4a97207e815d08b2847be606091e6ba--