Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujobP-00CJlT-9Y for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 00:35:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ujobM-001sUc-GO for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Aug 2025 00:35:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujobL-001sUU-Ot for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 00:35:24 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1ujobI-0018Bw-1L for pgsql-hackers@lists.postgresql.org; Thu, 07 Aug 2025 00:35:22 +0000 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0D41A14000C9; Wed, 6 Aug 2025 20:35:20 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-07.internal (MEProxy); Wed, 06 Aug 2025 20:35:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1754526920; x=1754613320; bh=gA+hsfFBAsb/Z/whLOoGSbFfBFawnYMT3+68Y597n/c=; b= oNutdKtQxgmNb4tHzSLjYX4SL3fbflzfp77PZXkJ04bAG1YdqRbgWWc6W+0cgaQk Pv1JJ9gXgApFPFn+ym/PQxnrxPVtcvEIRLWEdMhQN7++H3Ip1oFXF0XMvlxAC8IC EqRJTYLz8rx+ye7yR2DAVc4Xi0HIvn7yGkwP3OY7PBZdl0SGjuXdTyVutxT132q7 vPaiQQG4pi5I3vn3W70h1grZBUE62JJ+OpmoCTVaPYw0SZksTGGsSPUnf/9IJ/w0 WiUEH719xd7+BEUV/4ovTKiyNMAS6MQk1JKj0JYo47qOBBh29zDkUxM6vRytFnbS jpTPdQNi88FtJPE7FTvtHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1754526920; x= 1754613320; bh=gA+hsfFBAsb/Z/whLOoGSbFfBFawnYMT3+68Y597n/c=; b=e 2ImO3S2iBX11PMh0YnwuNSQ1T8kdXNnyq0qpj3xBngu9IyS6jffiRsIRX3aOMOSU RnQmrGp2E5RhZ6AMu8HaBU5DmaVENx9L1M3B7o1jHCEyaemHkLJcl52NIxpFjgo7 /yn/AukRP1KEpNzIEyNV6FGVI+oaES/RPbTY3563t3Q74UY4JL4nrgI46a2KEwZg VjtUaShiOxA6mIgg3QHRw7FLlDm+n5mhg3/UhTWsf2YKgw7bMcd/VzMvATmovTQB ft+ZQPx00mYJD7Kay0ONJDHmetnpCSTeoe/GlIxX1ymv/Z37c0FUCyplrfUc9tu9 XesitjMdv5l10XLvSGRIQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudelheduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfgfhulhgv rhcuvfgrvhgvihhrrgdfuceovghulhgvrhesvghulhgvrhhtohdrtghomheqnecuggftrf grthhtvghrnhepleevgfeileegfffglefgfeefffeghfefvdeftdduvdffieeijeffudel iefhvdevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuhhlvghrsegvuhhl vghrthhordgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehprghvvghlrdhsthgvhhhulhgvsehgmhgrihhlrdgtohhmpdhrtghpthht ohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorh hg X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 92DEE182007A; Wed, 6 Aug 2025 20:35:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: T10fc56e95b3c6546 Date: Wed, 06 Aug 2025 21:34:58 -0300 From: "Euler Taveira" To: "Pavel Stehule" Cc: pgsql-hackers@lists.postgresql.org Message-Id: In-Reply-To: References: <03f03515-2068-4f5b-b357-8fb540883c38@app.fastmail.com> Subject: Re: event trigger support for PL/Python Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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/