Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7gBI-0006MP-0N for pgsql-general@arkaria.postgresql.org; Fri, 28 Feb 2020 13:59:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7gBG-0004h7-QN for pgsql-general@arkaria.postgresql.org; Fri, 28 Feb 2020 13:59:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7gBG-0004go-Gt for pgsql-general@lists.postgresql.org; Fri, 28 Feb 2020 13:59:54 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7gBC-00086Q-CV for pgsql-general@lists.postgresql.org; Fri, 28 Feb 2020 13:59:54 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 48TWPb46ntz1XdC; Fri, 28 Feb 2020 08:59:47 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 48TWPb2QRQzfYm; Fri, 28 Feb 2020 08:59:47 -0500 (EST) Date: Fri, 28 Feb 2020 08:59:47 -0500 From: stan To: Andrei Zhidenkov Cc: pgsql-general@lists.postgresql.org Subject: Re: A question relative to creating an audit table Message-ID: <20200228135947.GA16442@panix.com> References: <20200227212847.GB3663@panix.com> <7BF2891E-FA4E-49CC-8477-A0537572CD84@n26.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7BF2891E-FA4E-49CC-8477-A0537572CD84@n26.com> X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Feb 27, 2020 at 10:30:15PM +0100, Andrei Zhidenkov wrote: > Why not to pass TG_TABLE_SCHEMA and TG_TABLE_NAME in its arguments? > > > On 27. Feb 2020, at 22:28, stan wrote: > > > > I ma considering setting up a function, and triggers to put a record in an > > audit table when certain tables are altered. I pretty much think I know how > > to do this, with one exception. > > > > Can a function, called by a trigger, determine what table it was called > > for? > > I suppose I could do that. I have in mind a single function to accomplish the audit log, but I will have to have unique triggers for each table. I was just hoping not to have to do that. Are these values that I could read automatically? Or do I have to hard code them? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin