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 1qIvqD-0007SQ-Q4 for pgsql-general@arkaria.postgresql.org; Mon, 10 Jul 2023 18:42:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIvqC-0008KP-MV for pgsql-general@arkaria.postgresql.org; Mon, 10 Jul 2023 18:42:32 +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 1qIvqC-0008Ja-Bj for pgsql-general@lists.postgresql.org; Mon, 10 Jul 2023 18:42:32 +0000 Received: from resqmta-h1p-028594.sys.comcast.net ([2001:558:fd02:2446::2]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qIvq8-003KUc-71 for pgsql-general@lists.postgresql.org; Mon, 10 Jul 2023 18:42:31 +0000 Received: from resomta-h1p-027914.sys.comcast.net ([96.102.179.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits) (Client did not present a certificate) by resqmta-h1p-028594.sys.comcast.net with ESMTP id Iqc0qXpiRPVE1Ivq3qoKpG; Mon, 10 Jul 2023 18:42:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1689014543; bh=tuJSnSEWf0b2ncYIFeiKPguUspy4BHkP8VsU+RrEqco=; h=Received:Received:Date:From:To:Message-ID:Subject:MIME-Version: Content-Type:Xfinity-Spam-Result; b=CRIaWjxp8hGdpJ96zOELL1oOCeP3f3r0qEEwOwnjaXC6KMsVtzN0sgxpAVzovUgFE KOuC1LowQNFrmAJGvuTwtYARH5OAO21eS45viOB2eqA+LBhna5BMH5U0osKfRZRtIi rv74p3H1AS+FWi3oPdCH1RBpkGQbMl0sHDK0yXigdfq4A0y56wSw1DHGrv58uvjzok 8cY3mcGUVENysFCk05eJ6E63AODdFlBZp8OvFEcffhLdzb9BrvjAcH+Rr57yPtAzKX o1OS1jkFGFqmNquoO78f8VFihifgCGjhC8tM7K8tg+vbDilbIiQ/HBbtFCjf9pNlqo /pD2aV8/I69KQ== Received: from oxappp-hoa-22o.email.comcast.net ([96.116.234.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits) (Client did not present a certificate) by resomta-h1p-027914.sys.comcast.net with ESMTPS id Ivphq9u8FHWw0IvphqXa9k; Mon, 10 Jul 2023 18:42:01 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedviedrvdekgdduudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedtudenucenucfjughrpeffhffvvefkjghfufggtgfgrfgkofhisehtjegstdertdejnecuhfhrohhmpeffteggkfffucftqffvjfcuoegruggrphhtrhhonhestghomhgtrghsthdrnhgvtheqnecuggftrfgrthhtvghrnhepfeekteeiveehjeeigeegieduhfevteethefhgfevgefhveeviefgudevffdvleegnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepleeirdduudeirddvfeegrddvgeeipddviedtudemudeludemkeegtddtmeguvdgrtdemieelvdgrmegugegtvgemfegvtgdvmegvtdgsfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehogigrphhpphdqhhhorgdqvddvohdrvghmrghilhdrtghomhgtrghsthdrnhgvthdpihhnvghtpeeliedrudduiedrvdefgedrvdegiedpmhgrihhlfhhrohhmpegruggrphhtrhhonhestghomhgtrghsthdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeigohhfsehthhgvsghuihhlugdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-Xfinity-VMeta: sc=0.00;st=legit Date: Mon, 10 Jul 2023 14:42:00 -0400 (EDT) From: DAVID ROTH To: Christophe Pettus Cc: "pgsql-general@lists.postgresql.org" Message-ID: <1628697287.171908.1689014521034@connect.xfinity.com> In-Reply-To: <870476B2-8403-46F4-BA0F-A03E226B07E3@thebuild.com> References: <1875078143.170839.1689013230630@connect.xfinity.com> <1715546791.171305.1689013799237@connect.xfinity.com> <870476B2-8403-46F4-BA0F-A03E226B07E3@thebuild.com> Subject: Re: Trigger Function question MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev39 X-Originating-IP: 2601:191:8400:d2a0:692a:d4ce:3ec2:e0b3 X-Originating-Client: open-xchange-appsuite List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I was hoping that NEW could be treated as a record or as an arrayy similar to pg_argv. > On 07/10/2023 2:31 PM EDT Christophe Pettus wrote: > > > > On Jul 10, 2023, at 11:29, DAVID ROTH wrote: > > > > I want to use a single trigger function to log multiple tables and the tables have different columns. I can get the names of the columns from the catalog. But I have not been able to figure out how to get NEW.x when x is not known until run time. > > Unless you only want to log a subset of rows from each table, it's not required that you get the specific columns. Here's an example of how to do a generic auditing trigger: > > https://wiki.postgresql.org/wiki/Audit_trigger > > If it's supported on your platform, you might also look at the pg_audit extension.