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 1qywio-00CEC7-AG for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 16:08:34 +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 1qywim-001dnx-U8 for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2023 16:08:32 +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 1qywim-001dnp-JN for pgsql-general@lists.postgresql.org; Fri, 03 Nov 2023 16:08:32 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qywik-003mwC-4a for pgsql-general@lists.postgresql.org; Fri, 03 Nov 2023 16:08:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3A3G8T7p3307594; Fri, 3 Nov 2023 12:08:29 -0400 From: Tom Lane To: Garfield Lewis cc: "pgsql-generallists.postgresql.org" Subject: Re: How to tell which statement is being executed In-reply-to: References: Comments: In-reply-to Garfield Lewis message dated "Fri, 03 Nov 2023 14:58:18 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3307592.1699027709.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 03 Nov 2023 12:08:29 -0400 Message-ID: <3307593.1699027709@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Garfield Lewis writes: > If I create a C function, is there a way from within that function for m= e to: > 1. know whether it is being triggered by an INSERT or UPDATE statemen= t It might not be any of those. But if what you want is the most closely nested SQL action, inspecting the ActivePortal might help (see function_parse_error_transpose, which I think is the only in-core user). > 2. column attribute (specifically the TYPMOD) for the affected column No. How would you even define "affected column"? regards, tom lane