Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXiZl-0006ju-RA for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 13:02:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXiZk-0003SJ-Ec for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 13:02:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXiZi-0003S9-O0 for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 13:02:24 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXiZf-0006OI-6Q for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 13:02:22 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 956743200754; Thu, 2 Mar 2023 08:02:15 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute6.internal (MEProxy); Thu, 02 Mar 2023 08:02:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lateraljoin.com; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1677762135; x=1677848535; bh=i4 yJWy8BjJC4atIHU1bTwyx+hxh5z873vBl58RQrkFA=; b=mCxOHDRGjBm13c74CU FbIYwUYaTcaBoYT79nss4cJK4433sKxRTFp6E80WwhhFScawX1OFy1EIVReK+5k0 H96Lv4ZxVGkiTgA1yIJAqT7vAmA3jTltbmg1cvE0zk9ljxd2Pd2VDtB3GQ5UAiUn DVv8Twa9kqoWO4eII4yV6+A9VTE0bpH0+BoQfZwt4faKe1nhfSmjPVJTDKw10fj5 5GfNsHSUek24NINaN58z94mFYgrqP/yDzs6imSPWP7bwWB7ex2nt8DZi51dVky7v enjtaHFy8YbpGiomlJiR8vecndgIL+WHDOMr7+W4Pjpxdne8J31w+4RJ2qsT7T9j ga7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1677762135; x=1677848535; bh=i4yJWy8BjJC4a tIHU1bTwyx+hxh5z873vBl58RQrkFA=; b=lSEoyhAFUHbOMMPkfjRzlofbb8r5n FmnzOrjURYGeVo5LRed0YRIbKpoTRq9Xd5a/UDO2812hT9pjzaA1FkEZbce+/qW8 lECx10DOEmWpXn5M0oqDGDfjTfnCUEGMs8bTWILLYwlOQ3Emgq4BM/imd3vE2eHo KKpB9R6PjqLcqmgatKOlE2FDkFmil45Q6gShGaL0GmJB9Yv+JvAML2YQQnB4Kn8q JE2T4NIXYEy+Widp5qa7cQfohKVEGNLvRuSIjKilZYAd9zwpgoJjQw4AtI5T74bI A9POTzNj9gNiCHansMXWTcI+k/pdIg++W8FOzdPx02eUDTxTo7rnyAK7A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeljedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsehttd ertderredtnecuhfhrohhmpedflfhovgcuhghilhguihhshhdfuceojhhovgeslhgrthgv rhgrlhhjohhinhdrtghomheqnecuggftrfgrthhtvghrnhepheehudeuteehgfffudetvd duvefgveevvdehvedvleehfeejueefueeltdeludffnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepjhhovgeslhgrthgvrhgrlhhjohhinhdrtg homh X-ME-Proxy: Feedback-ID: i7cb144c0:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B92D92A2008B; Thu, 2 Mar 2023 08:02:14 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5 Mime-Version: 1.0 Message-Id: <27d484ae-98b0-44aa-8718-7fda1387b5b8@app.fastmail.com> In-Reply-To: References: <10164c95-ef23-4624-9251-ea6ff594cd1c@app.fastmail.com> Date: Thu, 02 Mar 2023 13:01:54 +0000 From: "Joe Wildish" To: pgsql-general@lists.postgresql.org, depesz@depesz.com Subject: Re: Getting the exact SQL from inside an event trigger Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Depesz, On Thu, 2 Mar 2023, at 12:29, hubert depesz lubaczewski wrote: > This might be a bit different answer from what you expect, but have you > seen pgl_ddl_deploy project? Thanks --- I was unaware of this project so I will take a look. However, we are operating under a limitation that the publisher is in a hosted provider, so we cannot install extensions unless they are "blessed"; hence looking for a solution that doesn't require that. I did go and look at what pgaudit does WRT to this problem as I know that that extension can emit just the statement being executed. I didn't fully understand all the detail, but did notice that it maintains a stack of statements for the current execution, presumably so it knows if the trigger has been called already, e.g. in the case of a DO block. This indicates to me that I can't do what I would like in pure PLPGSQL triggers. -Joe