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 1qIvlU-0007HU-GE for pgsql-general@arkaria.postgresql.org; Mon, 10 Jul 2023 18:37:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIvlT-0005Np-03 for pgsql-general@arkaria.postgresql.org; Mon, 10 Jul 2023 18:37:39 +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 1qIvlS-0005Nf-Ls for pgsql-general@lists.postgresql.org; Mon, 10 Jul 2023 18:37:38 +0000 Received: from resdmta-h1p-028482.sys.comcast.net ([2001:558:fd02:2446::c]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qIvlO-003KRn-Jh for pgsql-general@lists.postgresql.org; Mon, 10 Jul 2023 18:37:37 +0000 Received: from resomta-h1p-027910.sys.comcast.net ([96.102.179.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits) (Client did not present a certificate) by resdmta-h1p-028482.sys.comcast.net with ESMTP id IpfJqKtYJ6lfRIvlJqag81; Mon, 10 Jul 2023 18:37:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1689014249; bh=2j8CUMC6lBoNyk319zbhdgQ2QVXQQyIW2p+aQyC3uUM=; h=Received:Received:Date:From:To:Message-ID:Subject:MIME-Version: Content-Type:Xfinity-Spam-Result; b=IPWaNrzRRU84cwhdNmYBxOai028K+iQrBcAiaQZsvFHc7DAjuDJnoabYaIwRo1XjV j2UDc57vjkIl3nrdUTFNUcBfUyn7fHJ+zNThj9i5ZXgIrVuGFkKG85HHSAEHcvUy44 HCwnbyvDTE8l2pJnTLM84//LK36Q4cS1tkc03nqQ9G7C2DVRnQIL7tEbNrL+dbxMXQ vBi40JLTU74XG/8xoswFM1g5+b1SoXBMPIikqe2hPLC8WWvLVyXkmmyixLIWIhv0py MoxK4S7tzJyOlTBVauzwls/gfTw+zh/wrpevHBu7hzhdQCnKwKQBTBMLqh5MYTaQdG DBe0CiEXzf9jQ== 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-027910.sys.comcast.net with ESMTPS id IvkwqwRpJtPEkIvkwqCbyN; Mon, 10 Jul 2023 18:37:07 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedviedrvdekgdduudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedtudenucenucfjughrpeffhffvvefkjghfufggtgfgrfgkofhisehtjegstdertdejnecuhfhrohhmpeffteggkfffucftqffvjfcuoegruggrphhtrhhonhestghomhgtrghsthdrnhgvtheqnecuggftrfgrthhtvghrnhepfeekteeiveehjeeigeegieduhfevteethefhgfevgefhveeviefgudevffdvleegnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepleeirdduudeirddvfeegrddvgeeipddviedtudemudeludemkeegtddtmeguvdgrtdemieelvdgrmegugegtvgemfegvtgdvmegvtdgsfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehogigrphhpphdqhhhorgdqvddvohdrvghmrghilhdrtghomhgtrghsthdrnhgvthdpihhnvghtpeeliedrudduiedrvdefgedrvdegiedpmhgrihhlfhhrohhmpegruggrphhtrhhonhestghomhgtrghsthdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeigohhfsehthhgvsghuihhlugdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-Xfinity-VMeta: sc=0.00;st=legit Date: Mon, 10 Jul 2023 14:37:06 -0400 (EDT) From: DAVID ROTH To: Christophe Pettus Cc: "pgsql-general@lists.postgresql.org" Message-ID: <242941212.171664.1689014226731@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 Thanks for the example. I have a test trigger now that does that but my application needs all of the columns. > 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.